修改了一部分代码,使用listview实现了浏览信息

my
盛洁 5 years ago
parent 2cdca89b2e
commit 55e289cf11

@ -1,6 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="盛洁">
<words>
<w>descri</w>
<w>sttmt</w>
</words>
</dictionary>

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="hunnu.sj.raise_money">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/img_2"
@ -9,7 +11,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".NewsContentActivity"></activity>
<activity android:name=".BrowseRecordActivity"></activity>
<activity android:name=".NewsContentActivity" />
<activity android:name=".RegiteActivity" />
<activity android:name=".SignInActivity">
<intent-filter>
@ -22,6 +25,7 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/AppTheme.NoActionBar" />
</application>

@ -0,0 +1,15 @@
package hunnu.sj.raise_money;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class BrowseRecordActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browse_record);
}
}

@ -13,7 +13,7 @@ public class DatabaseHelper {
}
public static Connection getConnection(){
public static Connection getConnection(){//数据库连接池
String username = "root";
String password ="12345678";
if(conn==null){

@ -1,10 +1,17 @@
package hunnu.sj.raise_money.DataBase;
import android.content.Context;
import androidx.core.content.ContextCompat;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import hunnu.sj.raise_money.News;
import hunnu.sj.raise_money.R;
import hunnu.sj.raise_money.User;
public class UserService {
@ -13,6 +20,7 @@ public class UserService {
public UserService(){
this.db = DatabaseHelper.getDb();
}
public int login(String username,String password){
conn = db.getConnection();
Statement sttmt = null;
@ -42,7 +50,7 @@ public class UserService {
}
public boolean register(User user){
conn = db.getConnection();
conn = db.getConnection();//将用户的信息上传到数据库上传成功返回true失败false
try{
String sql = "insert into user(username,password,role) values('"+user.getName()+"','"+user.getPasd()+"','"+user.getRole()+"')";
Statement sttmt = conn.createStatement();
@ -55,7 +63,7 @@ public class UserService {
return false;
}
public String getRole(String username){
public String getRole(String username){//从数据库获取用户的角色
//SQLiteDatabase sdb=dbHelper.getReadableDatabase();
String sql="select role from user where username = '" + username+"'";
conn = db.getConnection();
@ -73,4 +81,37 @@ public class UserService {
return null;
}
public boolean UploadInfo(News news){//用户上传信息到数据库,服务器
String sql = "insert into stu_info(name,descri) values('"+news.getTitle()+"','"+news.getDes() + "')";
conn = db.getConnection();
try{
Statement sttmt = conn.createStatement();
sttmt.executeUpdate(sql);
sttmt.close();
return true;
}catch (SQLException e){
e.printStackTrace();
}
return false;
}
public void getAllNews(Context context,ArrayList<News> list){
ArrayList<News> mlist = list;
String sql = "select * from stu_info";
conn = db.getConnection();
try{
Statement sttmt = conn.createStatement();
ResultSet rs = sttmt.executeQuery(sql);
while (rs.next()){
News news= new News();
news.setTitle(rs.getNString("name"));
news.setDes(rs.getNString("descri"));
news.setHead_icon(ContextCompat.getDrawable(context, R.drawable.ic_launcher_background));
list.add(news);
}
}catch(SQLException e){
e.printStackTrace();
}
}
}

@ -1,6 +1,8 @@
package hunnu.sj.raise_money;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
@ -9,6 +11,9 @@ import com.google.android.material.snackbar.Snackbar;
import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.ListFragment;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
@ -22,13 +27,25 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener{
private AppBarConfiguration mAppBarConfiguration;
private Toolbar toolbar;
private ActionBarDrawerToggle mToggle;
private DrawerLayout mDrawerlayout;
private NavigationView navigationView;
private
TextView menu_name;
TextView menu_role;
ArrayList<News> list = new ArrayList<>();
Context mContext;
private NewsAdapter newsAdapter;
private ListView lv_news;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -37,9 +54,20 @@ public class MainActivity extends AppCompatActivity {
Intent intent = getIntent();
User user;
user = (User) intent.getSerializableExtra("user");
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
mContext = this;
newsAdapter = new NewsAdapter(this,list);
init();
if(navigationView.getHeaderCount() > 0) {//设置侧滑栏的显示的值
View header = navigationView.getHeaderView(0);
TextView menu_name = header.findViewById(R.id.user_name);
TextView menu_role = header.findViewById(R.id.user_role);
menu_name.setText(user.getName());
menu_role.setText(user.getRole());
}
/*Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@ -62,13 +90,47 @@ public class MainActivity extends AppCompatActivity {
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
if(navigationView.getHeaderCount() > 0) {
if(navigationView.getHeaderCount() > 0) {//设置侧滑栏的显示的值
View header = navigationView.getHeaderView(0);
TextView menu_name = header.findViewById(R.id.user_name);
TextView menu_role = header.findViewById(R.id.user_role);
menu_name.setText(user.getName());
menu_role.setText(user.getRole());
}
}*/
//setContentView(R.layout.content_main);
//new UploadThread().start();
lv_news = findViewById(R.id.list);
lv_news.setAdapter(newsAdapter);
lv_news.setOnItemClickListener(this);
News news = new News();
news.setTitle("火箭发射成功");
news.setDes("地方上的房贷首付读书首付第三方的手房贷首付第三方的手负担");
news.setHead_icon(ContextCompat.getDrawable(this, R.drawable.ic_launcher_background));
list.add(news);
new UploadThread().start();
}
private void init(){
toolbar = (Toolbar) findViewById(R.id.toolbar);
mDrawerlayout = (DrawerLayout)findViewById(R.id.drawer_layout);
toolbar.setTitle("");
mToggle = new ActionBarDrawerToggle(this, mDrawerlayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
mDrawerlayout.addDrawerListener(mToggle);
mToggle.syncState();
mDrawerlayout.setDrawerListener(mToggle);
navigationView = findViewById(R.id.nav_view);
}
@Override//点击条目时调用该方法parent指listviewposition指条目位置
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
News news = (News)parent.getItemAtPosition(position);
String url = "www.baidu.com";
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
}
@Override
@ -78,15 +140,30 @@ public class MainActivity extends AppCompatActivity {
return true;
}
@Override
public boolean onSupportNavigateUp() {
private class UploadThread extends Thread{
@Override
public void run() {
NewsUtils.getAllNews(mContext,list);
newsAdapter.notifyDataSetChanged();
}
}
/*public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
}*/
public void onNeedHelp(MenuItem item){
public void onNeedHelp(MenuItem item){//侧滑栏的item用于提交信息
Intent intent = new Intent(this, UploadActivity.class);
startActivity(intent);
}//ssds
}
public void onBrowseDonateRecord(MenuItem item){
Intent intent = new Intent(this,BrowseRecordActivity.class);
startActivity(intent);
}
}

@ -0,0 +1,24 @@
package hunnu.sj.raise_money;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.navigation.fragment.NavHostFragment;
public class MyFragment extends NavHostFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
FrameLayout frameLayout = new FrameLayout(inflater.getContext());
// When added via XML, this has no effect (since this FrameLayout is given the ID
// automatically), but this ensures that the View exists as part of this Fragment's View
// hierarchy in cases where the NavHostFragment is added programmatically as is required
// for child fragment transactions
frameLayout.setId(getId());
return frameLayout;
}
}

@ -1,18 +1,30 @@
package hunnu.sj.raise_money;
public class News {
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
public class News {//主界面浏览的信息的类
private String title;
private String content;
private String des;
private Drawable head_icon;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
public String getDes() {
return des;
}
public void setDes(String content) {
this.des = content;
}
public void setContent(String content) {
this.content = content;
public Drawable getHead_icon() {
return head_icon;
}
public void setHead_icon(Drawable head_icon) {
this.head_icon = head_icon;
}
}

@ -1,31 +1,54 @@
package hunnu.sj.raise_money;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
import java.util.ArrayList;
//信息的适配器
public class NewsAdapter extends BaseAdapter {
private ArrayList<News> list;
private Context context;
public NewsAdapter(Context context,ArrayList<News> list) {
public class NewsAdapter extends ArrayAdapter<News> {
private int resourceId;
public NewsAdapter(Context context, int textViewResourceId, List<News> objects) {
super(context, textViewResourceId, objects);
resourceId = textViewResourceId;
this.context = context;
this.list = list;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position){
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
News news = getItem(position);
View view;
if (convertView == null) {
view = LayoutInflater.from(getContext()).inflate(resourceId, null);
} else {
view = convertView;
View view = null;
if(convertView != null){
view = convertView;
}else{
view = View.inflate(context,R.layout.info_item_layout,null);
}
TextView newsTitleText =(TextView) view.findViewById(R.id.news_title);
newsTitleText.setText(news.getTitle());
ImageView item_icon = (ImageView) view.findViewById(R.id.item_head_icon);
TextView item_title = (TextView) view.findViewById(R.id.item_info_title);
TextView item_des = (TextView) view.findViewById(R.id.item_info_des);
News news = list.get(position);
item_icon.setImageDrawable(news.getHead_icon());
item_title.setText(news.getTitle());
item_des.setText(news.getDes());
return view;
}
}

@ -1,69 +0,0 @@
package hunnu.sj.raise_money;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.app.Fragment;
import java.util.ArrayList;
import java.util.List;
public class NewsTitleFragment extends Fragment implements AdapterView.OnItemClickListener {
private ListView newsTitleListView;
private List<News> newsList;
private NewsAdapter adapter;
private boolean isTwoPane;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
newsList = getNews(); // 初始化新闻数据
adapter = new NewsAdapter(activity, R.layout.news_item, newsList);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_news_title, container, false);
newsTitleListView = (ListView) view.findViewById(R.id.news_title_list_view);
newsTitleListView.setAdapter(adapter);
newsTitleListView.setOnItemClickListener(this);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
isTwoPane = false; // 可以找到news_content_layout布局时为双页模式
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
News news = newsList.get(position);
if (isTwoPane) {
// 如果是双页模式则刷新NewsContentFragment中的内容
NewsContentFragment newsContentFragment = (NewsContentFragment) getFragmentManager().findFragmentById(R.id.news_content_fragment);
newsContentFragment.refresh(news.getTitle(), news.getContent());
} else {
// 如果是单页模式则直接启动NewsContentActivity
NewsContentActivity.actionStart(getActivity(), news.getTitle(), news.getContent());
}
}
private List<News> getNews() {
List<News> newsList = new ArrayList<News>();
News news1 = new News();
news1.setTitle("Succeed in College as a Learning Disabled Student");
news1.setContent("College freshmen will soon learn to live with a"
+"roommate, adjust to a new social scene and survive less-than-stellar"
+"dining hall food. Students with learning disabilities will face these"
+"transitions while also grappling with a few more hurdles.");
newsList.add(news1);
News news2 = new News();
news2.setTitle("Google Android exec poached by China's Xiaomi");
news2.setContent("China's Xiaomi has poached a key Google executive"+
"involved in the tech giant's Android phones, in a move seen as a coup"+
" for the rapidly growing Chinese smartphone maker.");
newsList.add(news2);
return newsList;
}
}

@ -2,11 +2,23 @@ package hunnu.sj.raise_money;
import android.content.Context;
import androidx.core.content.ContextCompat;
import java.util.ArrayList;
import hunnu.sj.raise_money.DataBase.UserService;
public class NewsUtils {
public static ArrayList<News> getAllNews(Context context){//从数据库获取信息到本地
ArrayList<News> list = new ArrayList<News>();
return list;
public static void getAllNews(Context context,ArrayList<News> list){//从数据库获取信息到本地
UserService uService = new UserService();
uService.getAllNews(context,list);
/*for(int i = 0 ;i <100;i++)
{
News news = new News();
news.setTitle("火箭发射成功");
news.setDes("地方上的房贷首付读书首付第三方的手房贷首付第三方的手负担");
news.setHead_icon(ContextCompat.getDrawable(context, R.drawable.ic_launcher_background));
list.add(news);
}*/
}
}

@ -13,7 +13,7 @@ import android.widget.RadioButton;
import hunnu.sj.raise_money.DataBase.UserService;
//用户注册
public class RegiteActivity extends AppCompatActivity {
EditText user_name;
EditText pass_word;
@ -24,7 +24,7 @@ public class RegiteActivity extends AppCompatActivity {
Handler rHandler = new Handler(){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
super.handleMessage(msg);//用户在主线程中处理子线程发送回来的消息,更改控件内容
String txt = (String) msg.obj;
switch (msg.what){
case 0:
@ -61,6 +61,7 @@ public class RegiteActivity extends AppCompatActivity {
}else if(radio2.isChecked()){
role = "贫困学生";
}
//获取注册界面的控件
new RegiteThread().start();
}
@ -69,10 +70,10 @@ public class RegiteActivity extends AppCompatActivity {
public void run() {
String username = user_name.getText().toString();
String password = pass_word.getText().toString();
String repassword = repass_word.getText().toString();
String repassword = repass_word.getText().toString();//从控件获取字符
UserService uService = new UserService();
Message message = rHandler.obtainMessage();
if(username.trim().equals("")){
Message message = rHandler.obtainMessage();//使用handler来处理信息
if(username.trim().equals("")){//一系列条件来判断是否可注册
message.what = 0;
message.obj = "请输入用户名";
rHandler.sendMessage(message);
@ -87,13 +88,13 @@ public class RegiteActivity extends AppCompatActivity {
}else if(uService.login(username,password)!=0){
message.what = 3;
message.obj = "用户已存在";
rHandler.sendMessage(message);
rHandler.sendMessage(message);//发送信息给handler
}else{
User user = new User();
user.setName(username);
user.setPasd(password);
user.setRole(role);
uService.register(user);
uService.register(user);//注册
Intent intent = new Intent(RegiteActivity.this,SignInActivity.class);
startActivity(intent);
finish();

@ -13,6 +13,8 @@ import android.widget.Button;
import android.widget.EditText;
import java.util.ArrayList;
import hunnu.sj.raise_money.DataBase.UserService;
public class SignInActivity extends AppCompatActivity {
@ -22,7 +24,7 @@ public class SignInActivity extends AppCompatActivity {
EditText pswd;
UserService uService;
User user;
Handler mHandler = new Handler(){
Handler mHandler = new Handler(){//用于处理子线程传回的消息对主线的UI进行修改
int flag = -1;
@Override
public void handleMessage(@NonNull Message msg) {
@ -65,16 +67,16 @@ public class SignInActivity extends AppCompatActivity {
class LoginThread extends Thread{
@Override
public void run() {
int flag = -1;
int flag = -1;//先设置flag为-1
String name = usnm.getText().toString();
String pasd = pswd.getText().toString();
//UserService uService = new UserService();
flag = uService.login(name,pasd);
flag = uService.login(name,pasd);//用login函数来判断用户输入的用户名与密码是否正确
Message message = mHandler.obtainMessage();
if(flag==0){
message.what = 0;
message.obj = "用户名不存在";
mHandler.sendMessage(message);
mHandler.sendMessage(message);//使用handler给主线程发送消息
}else if(flag==1){
message.what = 1;
message.obj = "密码错误";
@ -85,7 +87,7 @@ public class SignInActivity extends AppCompatActivity {
user.setPasd(pasd);
String role = uService.getRole(name);
user.setRole(role);
Bundle bundle = new Bundle();
Bundle bundle = new Bundle();//将类包装到bundle里再放到intent里
bundle.putSerializable("user",user);
Intent intent =new Intent(SignInActivity.this,MainActivity.class);
intent.putExtras(bundle);

@ -3,21 +3,27 @@ package hunnu.sj.raise_money;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.FileProvider;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import hunnu.sj.raise_money.DataBase.UserService;
import hunnu.sj.raise_money.R;
public class UploadActivity extends AppCompatActivity {
@ -25,14 +31,18 @@ public class UploadActivity extends AppCompatActivity {
private ImageView stu_pic;
private ImageView[] stu_src;
private Uri imageUri;
private EditText info_name;
private EditText info_desc;
private Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload);
stu_pic = findViewById(R.id.stu_pic);
context = this;
//stu_pic = findViewById(R.id.stu_pic);
}
protected void onUploadPic(View view){
public void onUploadPic(View view){
/*File outputImage = new File(getExternalCacheDir(),"output_image.jpg");
try {
if(outputImage.exists()){
@ -48,9 +58,38 @@ public class UploadActivity extends AppCompatActivity {
imageUri = Uri.fromFile(outputImage);
}*/
Intent intent = new Intent(Intent.ACTION_PICK,null);
/*Intent intent = new Intent(Intent.ACTION_PICK,null);
intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,"image/*");
startActivityForResult(intent,1);
startActivityForResult(intent,1);*/
info_name = findViewById(R.id.info_name);
info_desc = findViewById(R.id.info_desc);
new UploadThread().start();
}
private class UploadThread extends Thread{
@Override
public void run() {
String name = info_name.getText().toString();
String desc = info_desc.getText().toString();
News news = new News();
news.setTitle(name);
news.setDes(desc);
UserService uService = new UserService();
if(uService.UploadInfo(news)){
Looper.prepare();
Toast toast =Toast.makeText(context,"信息上传成功",Toast.LENGTH_SHORT);
toast.show();
Intent intent = new Intent(UploadActivity.this,MainActivity.class);
startActivity(intent);
Looper.loop();
}else{
Looper.prepare();
Toast toast =Toast.makeText(context,"信息上传失败",Toast.LENGTH_SHORT);
toast.show();
Looper.loop();
}
}
}
private void onLoadPic(){

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".BrowseRecordActivity">
<ListView
android:id="@+id/lv_browse_denate_record"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -7,7 +7,7 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<!--侧滑栏的布局-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".RegiteActivity">
<!--注册界面的布局-->
<EditText
android:id="@+id/user_name"
android:layout_width="wrap_content"

@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:background="@drawable/beijin"
tools:context=".Initial">
<!--登录界面的布局-->
<EditText
android:id="@+id/user_name"
android:layout_width="wrap_content"

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".UploadActivity">
<!--上传信息的布局(暂时)-->
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -34,7 +34,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@android:dimen/app_icon_size"
android:onClick="onUploadPic"
android:text="上传图片" />
</LinearLayout>
@ -44,7 +43,15 @@
android:orientation="vertical">
<EditText
android:id="@+id/editText"
android:id="@+id/info_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="姓名"
android:inputType="textPersonName" />
<EditText
android:id="@+id/info_desc"
android:layout_width="fill_parent"
android:layout_height="125dp"
android:layout_marginTop="@dimen/activity_horizontal_margin"
@ -104,6 +111,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:gravity="center"
android:onClick="onUploadPic"
android:text="提交" />
</LinearLayout>

@ -6,21 +6,17 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_main">
<!--主界面的布局(新闻)-->
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation" />
<ListView
android:id="@+id/list"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" >
</ListView>
<fragment
android:id="@+id/fragment"
android:name="hunnu.sj.raise_money.NewsContentFragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:orientation="horizontal" >
<ImageView
android:id="@+id/item_head_icon"
android:layout_width="68dp"
android:layout_height="68dp"
android:layout_gravity="center"
android:layout_marginRight="10dp"
app:srcCompat="@mipmap/ic_launcher" />
<LinearLayout
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:singleLine="true"
android:id="@+id/item_info_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:text="title"
android:textColor="#000000"
android:textSize="16sp" />
<TextView
android:maxLines="2"
android:id="@+id/item_info_des"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="des"
android:textColor="#666666"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>

@ -12,7 +12,7 @@
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<!--侧滑栏用户头像-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"

@ -8,4 +8,5 @@
android:name="hunnu.sj.raise_money.NewsContentFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

@ -4,4 +4,8 @@
android:id="@+id/needhelp"
android:onClick="onNeedHelp"
android:title="@string/need_help" />
<item
android:id="@+id/browse_donate_record"
android:onClick="onBrowseDonateRecord"
android:title="@string/browse_donate_record" />
</menu>

@ -17,6 +17,7 @@
<string name="menu_role">用户角色</string>
<string name="menu_pic">HeadPortrait</string>
<string name="need_help">申请帮助</string>
<string name="browse_donate_record">查看捐款记录</string>
<string name="on_upload_pic">onUploadPic</string>
<!-- TODO: Remove or change this placeholder text -->

Loading…
Cancel
Save