注:1.安卓作业分享,源码来自《Android移动开发项目式教程(第2版)》
2.分享给期末忙着不想敲作业的同学
3.如果有帮助,记得给个攒哦
1. AndroidManifest.xml
<!-- AndroidManifest.xml --><?xml version=\"1.0\" encoding=\"utf-8\"?><manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"package=\"com.zhy.myapplication\"><applicationandroid:allowBackup=\"true\"android:icon=\"@mipmap/ic_launcher\"android:label=\"@string/app_name\"android:roundIcon=\"@mipmap/ic_launcher_round\"android:supportsRtl=\"true\"android:theme=\"@style/AppTheme\"><providerandroid:authorities=\"con.zhy.mycontacts.mycontactscontentprovider\"android:name=\".Actions.MyContactsContentProvider\"android:exported=\"true\"/><activity android:name=\".MainActivity\"><intent-filter><action android:name=\"android.intent.action.MAIN\" /><category android:name=\"android.intent.category.LAUNCHER\" /></intent-filter></activity><!-- 增加号码录入Activity--><activity android:name=\".Actions.AddContactsActivity\"></activity><!-- 修改号码录入Activity--><activity android:name=\".Actions.UpdateContactsActivity\"></activity><!-- 查询号码录入Activity--><activity android:name=\".Actions.ContactsMessageActivity\"></activity></application><!-- 添加导出手机电话本所需要的权限--><uses-permission android:name=\"android.permission.READ_CONTACTS\"/><uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/></manifest>
2.MainActivity.java
package com.zhy.myapplication;import androidx.annotation.NonNull;import androidx.appcompat.app.AppCompatActivity;import android.annotation.SuppressLint;import android.app.AlertDialog;import android.app.Dialog;import android.content.Context;import android.content.DialogInterface;import android.content.Intent;import android.graphics.Color;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.view.ViewGroup;import android.widget.AdapterView;import android.widget.BaseAdapter;import android.widget.Button;import android.widget.EditText;import android.widget.ListView;import android.widget.TextView;import android.widget.Toast;import com.zhy.myapplication.Actions.AddContactsActivity;import com.zhy.myapplication.Actions.ContactsMessageActivity;import com.zhy.myapplication.Actions.UpdateContactsActivity;import com.zhy.myapplication.Contact.ContactsTable;import com.zhy.myapplication.Contact.User;public class MainActivity extends AppCompatActivity {private ListView listView;//显示结果列表private BaseAdapter listViewAdapter;//ListView 列表适配器private User users[];//通讯录用户private int selecteItem = 0; //当前选择的数据项@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);setTitle(\"通讯录\");listView = (ListView)findViewById(R.id.listView);//绑定listViewloadContacts();//加载数据}/*** 加载联系人列表*/private void loadContacts(){//获取所有通讯录联系人ContactsTable ct = new ContactsTable(this);users = ct.getAllUser();//为listView列表创建适配器listViewAdapter = new BaseAdapter() {@SuppressLint(\"SetTextI18n\")@Overridepublic View getView(int position, View convertView, ViewGroup parent) {if (convertView == null) {TextView textView = new TextView(MainActivity.this);textView.setTextSize(22);convertView = textView;}String mobile = users[position].getMobile() == null ? \"\" : users[position].getMobile();((TextView) convertView).setText(users[position].getName() + \"---\" + mobile);if (position == selecteItem) {convertView.setBackgroundColor(Color.YELLOW);} else {convertView.setBackgroundColor(0);}return convertView;}@Overridepublic int getCount() {return users.length;}@Overridepublic Object getItem(int position) {return users[position];}@Overridepublic long getItemId(int position) {return position;}};//设置listVIew控件的适配器listView.setAdapter(listViewAdapter);listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {@Overridepublic void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {selecteItem = arg2; //记录单击列的位置listViewAdapter.notifyDataSetChanged();//刷新列表}});}/*** 创建菜单*/public boolean onCreateOptionsMenu(Menu menu){menu.add(Menu.NONE,1,Menu.NONE,\"添加\");menu.add(Menu.NONE,2,Menu.NONE,\"编辑\");menu.add(Menu.NONE,3,Menu.NONE,\"查看信息\");menu.add(Menu.NONE,4,Menu.NONE,\"删除\");menu.add(Menu.NONE,5,Menu.NONE,\"查询\");menu.add(Menu.NONE,6,Menu.NONE,\"退出\");return super.onCreateOptionsMenu(menu);}/*** 菜单事件*/public boolean onOptionsItemSelected(MenuItem item){String sHint;switch (item.getItemId()){case 1://添加Intent intent = new Intent(MainActivity.this, AddContactsActivity.class);startActivity(intent);break;case 2://编辑//根据数据库ID判断当前记录是否可以操作if(users[selecteItem].getId_DB() > 0){intent = new Intent(MainActivity.this, UpdateContactsActivity.class);intent.putExtra(\"user_ID\",users[selecteItem].getId_DB());startActivity(intent);}else{sHint = \"无结果记录,无法操作!\";Toast.makeText(this,sHint,Toast.LENGTH_SHORT).show();}break;case 3://查看信息if(users[selecteItem].getId_DB() > 0){intent = new Intent(MainActivity.this, ContactsMessageActivity.class);intent.putExtra(\"user_ID\",users[selecteItem].getId_DB());startActivity(intent);}else{sHint = \"无结果,无法操作!\";Toast.makeText(this,sHint,Toast.LENGTH_SHORT).show();}break;case 4://删除if(users[selecteItem].getId_DB() > 0){delete();}else{sHint=\"无结果记录,无法操作!\";Toast.makeText(this,sHint,Toast.LENGTH_SHORT).show();}break;case 5://查询new FindDialog(this).show();break;case 6://退出finish();break;default:break;}return super.onOptionsItemSelected(item);}@Overrideprotected void onResume() {super.onResume();//重新加载数据ContactsTable ct = new ContactsTable(this);users = ct.getAllUser();//刷新数据显示列表listViewAdapter.notifyDataSetChanged();}/*** 查询*/public class FindDialog extends Dialog {public FindDialog(@NonNull Context context) {super(context);}protected void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.find);setTitle(\"联系人查询\");Button find = (Button)findViewById(R.id.find);Button cancel = (Button)findViewById(R.id.cancel);find.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {EditText value = (EditText)findViewById(R.id.value);ContactsTable ct = new ContactsTable(MainActivity.this);users = ct.findUserByKey(value.getText().toString());System.out.println(\"输入框的值:\" +value.getText().toString());for(int i=0; i< users.length; i++){System.out.println(\"姓名是\"+users[i].getName()+\",电话是\" +users[i].getMobile());}listViewAdapter.notifyDataSetChanged();selecteItem = 0;dismiss();}});cancel.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {dismiss();}});}}/*** 删除联系人*/public void delete(){AlertDialog.Builder alert = new AlertDialog.Builder(this);alert.setTitle(\"系统信息\");alert.setMessage(\"是否删除联系人?\");alert.setPositiveButton(\"是\", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int whichButton) {ContactsTable ct = new ContactsTable((MainActivity.this));//删除联系人信息if(ct.deleteByUser(users[selecteItem])){//重新获取数据users=ct.getAllUser();//刷新列表listViewAdapter.notifyDataSetChanged();selecteItem = 0;Toast.makeText(MainActivity.this,\"删除成功!\",Toast.LENGTH_SHORT).show();}else{Toast.makeText(MainActivity.this,\"删除失败!\",Toast.LENGTH_SHORT).show();}}});alert.setNegativeButton(\"否\", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {}});alert.show();}/* //导入到手机电话本public void importPhone(String name,String phone){//系统通讯录ContentProvider的URLUri phoneURL = ContactsContract.Data.CONTENT_URI;ContentValues values = new ContentValues();//首先向RAWContacts.CONTENT_URI执行一个控制插入,目的是获取系统返回的rawContactIdUri rawContactUri = this.getContentResolver().insert(ContactsContract.RawContacts.CONTENT_URI,values);insert(ContactsContract.RawContacts.CONTENT_URI,values);long rawContactId = ContentUris.parseId(rawContactUri);//向data表插入姓名values.clear();values.put(ContactsContract.Data.RAW_CONTACT_ID,rawContactId);values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE);values.put(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME,name);this.getContentResolver().insert(phoneURL,values);//向data表插入电话号码values.clear();values.put(ContactsContract.Data.RAW_CONTACT_ID,rawContactId);values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);values.put(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE);this.getContentResolver().insert(phoneURL,values);}*/}
3.AddContactsActivity.java
package com.zhy.myapplication.Actions;import android.app.Activity;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.widget.EditText;import android.widget.Toast;import androidx.annotation.Nullable;import androidx.appcompat.app.AppCompatActivity;import com.zhy.myapplication.Contact.ContactsTable;import com.zhy.myapplication.Contact.User;import com.zhy.myapplication.R;public class AddContactsActivity extends AppCompatActivity {private EditText nameEditText; //姓名输入框private EditText mobileEditText; //手机输入框private EditText qqEditText; //qq输入框private EditText danweiEditText;//单位输入框private EditText addressEditText;//地址输入框@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.layout_add);setTitle(\"添加联系人\");//从已设置的页面布局获得对应的控件nameEditText = (EditText)findViewById(R.id.name);mobileEditText = (EditText)findViewById(R.id.mobile);danweiEditText = (EditText)findViewById(R.id.danWei);qqEditText = (EditText)findViewById(R.id.qq);addressEditText = (EditText)findViewById(R.id.address);}/*** 创建菜单*/public boolean onCreateOptionsMenu(Menu menu){menu.add(Menu.NONE,1, Menu.NONE,\"保存\");menu.add(Menu.NONE,2,Menu.NONE,\"返回\");return super.onCreateOptionsMenu(menu);}/*** 菜单事件*/public boolean onOptionsItemSelected(MenuItem item){switch (item.getItemId()){case 1://保存if(!nameEditText.getText().toString().equals(\"\")){User user = new User();user.setName(nameEditText.getText().toString());user.setMobile(mobileEditText.getText().toString());user.setDanwei(danweiEditText.getText().toString());user.setQq(qqEditText.getText().toString());user.setAddress(addressEditText.getText().toString());ContactsTable ct = new ContactsTable(AddContactsActivity.this);if(ct.addData(user)){Toast.makeText(AddContactsActivity.this,\"添加成功\",Toast.LENGTH_SHORT).show();finish();}else{Toast.makeText(AddContactsActivity.this,\"添加失败\",Toast.LENGTH_SHORT).show();}}else {Toast.makeText(AddContactsActivity.this,\"请输入数据!\",Toast.LENGTH_SHORT).show();break;}case 2://返回finish();break;default:break;}return super.onOptionsItemSelected(item);}}
4.ContactsMessageActivity.java
package com.zhy.myapplication.Actions;import android.annotation.SuppressLint;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.widget.TextView;import androidx.appcompat.app.AppCompatActivity;import com.zhy.myapplication.Contact.ContactsTable;import com.zhy.myapplication.Contact.User;import com.zhy.myapplication.R;/******************显示联系人界面*****************/public class ContactsMessageActivity extends AppCompatActivity {@SuppressLint(\"SetTextI18n\")@Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.message);setTitle(\"联系人信息\");TextView nameTextView; //姓名输入框TextView mobileTextView; //电话输入框TextView qqTextView; //qq输入框TextView danweiTextView; //单位输入框TextView addressTextView; //地址输入框User user;//从设置的页面布局查找对应的控件nameTextView = (TextView)findViewById(R.id.name);mobileTextView = (TextView)findViewById(R.id.mobile);danweiTextView = (TextView)findViewById(R.id.danWei);qqTextView = (TextView)findViewById(R.id.qq);addressTextView = (TextView)findViewById(R.id.address);//将要修改的联系人数据复制到用户界面进行显示Bundle localBundle = getIntent().getExtras();assert localBundle != null;int id = localBundle.getInt(\"user_ID\");ContactsTable ct = new ContactsTable(this);user = ct.getUserByID(id);nameTextView.setText(\"姓名:\"+user.getName());mobileTextView.setText(\"电话:\"+user.getMobile());qqTextView.setText(\"Q Q:\"+user.getQq());danweiTextView.setText(\"单位:\"+user.getDanwei());addressTextView.setText(\"地址:\"+user.getAddress());}/*** 创建菜单*/public boolean onCreateOptionsMenu(Menu menu){menu.add(Menu.NONE,1,Menu.NONE,\"返回\");return super.onCreateOptionsMenu(menu);}/*** 菜单事件*/public boolean onOptionsItemSelected(MenuItem item){if (item.getItemId() == 1) {//返回finish();}return super.onOptionsItemSelected(item);}}
5.MyContactContentProvider.java
package com.zhy.myapplication.Actions;import android.content.ContentProvider;import android.content.ContentValues;import android.content.UriMatcher;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import android.net.Uri;import androidx.annotation.NonNull;import androidx.annotation.Nullable;public class MyContactsContentProvider extends ContentProvider {private final static String AUTHORITY = \"con.zhy.mycontacts.mycontactscontentprovider\";private final static String PERSONS_PATH = \"person\";//多条数据private final static String PERSON_PATH = \"person/#\";//单条数据private final static int PERSONS = 1;private final static int PERSON = 2;private final static UriMatcher sMatcher = new UriMatcher(UriMatcher.NO_MATCH);static {// content://com.zhy.mycontacts.mycontactscontentprovide/personsMatcher.addURI(AUTHORITY,PERSON_PATH,PERSONS);// content://com.zhy.mycontacts.mycontactscontentprovide/person/#sMatcher.addURI(AUTHORITY,PERSON_PATH,PERSON);}private SQLiteDatabase db = null;//数据库对象@Overridepublic boolean onCreate() {//创建数据库return false;}@Nullable@Overridepublic Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {return null;}@Nullable@Overridepublic String getType(@NonNull Uri uri) {return null;}@Nullable@Overridepublic Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {return null;}@Overridepublic int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {return 0;}@Overridepublic int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {return 0;}}
6.UpdateContactsActivity.java
package com.zhy.myapplication.Actions;import android.app.Activity;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.widget.EditText;import android.widget.Toast;import androidx.appcompat.app.AppCompatActivity;import com.zhy.myapplication.Contact.ContactsTable;import com.zhy.myapplication.Contact.User;import com.zhy.myapplication.R;//修改号码记录操作界面public class UpdateContactsActivity extends AppCompatActivity {//姓名输入框private EditText nameEditText;//号码输入框private EditText mobileEditText;//单位输入框private EditText danweiEditText;//qqprivate EditText qqEditText;//地址private EditText addressEditText;//修改的联系人private User user;@Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.edit);setTitle(\"修改联系人\");//从已设置的页面布局查找对应的控件nameEditText = (EditText)findViewById(R.id.name);mobileEditText = (EditText)findViewById(R.id.mobile);danweiEditText = (EditText)findViewById(R.id.danWei);qqEditText = (EditText)findViewById(R.id.qq);addressEditText = (EditText)findViewById(R.id.address);//将要修改的联系人数据赋值到用户界面显示Bundle localBundle = getIntent().getExtras();int id = localBundle.getInt(\"user_ID\");ContactsTable ct = new ContactsTable(this);user = ct.getUserByID(id);nameEditText.setText(user.getName());mobileEditText.setText(user.getMobile());danweiEditText.setText(user.getDanwei());qqEditText.setText(user.getQq());addressEditText.setText(user.getAddress());}/*** 创建菜单*/public boolean onCreateOptionsMenu(Menu menu){menu.add(Menu.NONE,1,Menu.NONE,\"保存\");menu.add(Menu.NONE,2,Menu.NONE,\"返回\");return super.onCreateOptionsMenu(menu);}/*** 菜单事件*/public boolean onOptionsItemSelected(MenuItem item){switch (item.getItemId()){case 1: //保存if (!nameEditText.getText().toString().equals(\"\")){user.setName(nameEditText.getText().toString());user.setMobile(mobileEditText.getText().toString());user.setDanwei(danweiEditText.getText().toString());user.setQq(qqEditText.getText().toString());user.setAddress(addressEditText.getText().toString());ContactsTable ct = new ContactsTable(UpdateContactsActivity.this);//修改数据库联系人信息if (ct.updateUser(user)){Toast.makeText(UpdateContactsActivity.this,\"修改成功!\",Toast.LENGTH_SHORT).show();finish();}else {Toast.makeText(UpdateContactsActivity.this,\"修改失败!\",Toast.LENGTH_SHORT).show();}}else{Toast.makeText(UpdateContactsActivity.this,\"数据不能为空!\",Toast.LENGTH_SHORT).show();}break;case 2: //返回finish();break;default:break;}return super.onOptionsItemSelected(item);}}
1.main.xml
<?xml version=\"1.0\" encoding=\"utf-8\"?><LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"android:layout_width=\"match_parent\"android:layout_height=\"match_parent\"android:orientation=\"vertical\"><ListViewandroid:id=\"@+id/listV20000iew\"android:layout_weight=\"1.0\"android:layout_width=\"match_parent\"android:layout_height=\"match_parent\" /></LinearLayout>
2.edit.xml
<?xml version=\"1.0\" encoding=\"utf-8\"?><LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"android:layout_width=\"match_parent\"android:layout_height=\"match_parent\"android:orientation=\"vertical\"><!--姓名--><LinearLayoutandroid:layout_height=\"wrap_content\"android:layout_width=\"wrap_content\"android:orientation=\"horizontal\"android:layout_marginTop=\"10dp\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"姓名:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/name\"android:layout_width=\"302dp\"android:layout_height=\"wrap_content\" /></LinearLayout><!--单位--><LinearLayoutandroid:layout_width=\"wrap_content\"android:layout_height=\"wrap_content\"android:orientation=\"horizontal\"android:layout_marginTop=\"10dp\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"单位:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/danWei\"android:layout_width=\"302dp\"android:layout_height=\"wrap_content\"android:minLines=\"3\"/></LinearLayout><!--手机号码--><LinearLayoutandroid:layout_width=\"wrap_content\"android:layout_height=\"wrap_content\"android:layout_marginTop=\"10dp\"android:orientation=\"horizontal\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"电话:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/mobile\"android:layout_width=\"302dp\"android:layout_height=\"wrap_content\"android:inputType=\"number\"/></LinearLayout><!--qq--><LinearLayoutandroid:layout_width=\"wrap_content\"android:layout_height=\"wrap_content\"android:layout_marginTop=\"10dp\"android:orientation=\"horizontal\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"Q Q:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/qq\"android:layout_width=\"302dp\"android:layout_height=\"wrap_content\"android:inputType=\"number\"/></LinearLayout><!--地址--><LinearLayoutandroid:layout_height=\"wrap_content\"android:layout_width=\"wrap_content\"android:orientation=\"horizontal\"android:layout_marginTop=\"10dp\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"地址:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/address\"android:layout_width=\"302dp\"android:layout_height=\"wrap_content\"android:minLines=\"3\"/></LinearLayout></LinearLayout>
3.layout_add.xml
<?xml version=\"1.0\" encoding=\"utf-8\"?><LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"android:layout_width=\"match_parent\"android:layout_height=\"match_parent\"android:orientation=\"vertical\"><!--姓名--><LinearLayoutandroid:layout_height=\"wrap_content\"android:layout_width=\"wrap_content\"android:orientation=\"horizontal\"android:layout_marginTop=\"10dp\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"姓名\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/name\"android:layout_width=\"190dp\"android:layout_height=\"wrap_content\"/></LinearLayout><!--单位--><LinearLayoutandroid:layout_width=\"wrap_content\"android:layout_height=\"wrap_content\"android:orientation=\"horizontal\"android:layout_marginTop=\"10dp\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"单位\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/danWei\"android:layout_width=\"190dp\"android:layout_height=\"wrap_content\"android:minLines=\"3\"/></LinearLayout><!--手机号码--><LinearLayoutandroid:layout_width=\"wrap_content\"android:layout_height=\"wrap_content\"android:layout_marginTop=\"10dp\"android:orientation=\"horizontal\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"电话\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/mobile\"android:layout_width=\"190dp\"android:layout_height=\"wrap_content\"android:inputType=\"number\"/></LinearLayout><!--qq--><LinearLayoutandroid:layout_width=\"wrap_content\"android:layout_height=\"wrap_content\"android:layout_marginTop=\"10dp\"android:orientation=\"horizontal\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"qq\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/qq\"android:layout_width=\"190dp\"android:layout_height=\"wrap_content\"android:inputType=\"number\"/></LinearLayout><!--地址--><LinearLayoutandroid:layout_height=\"wrap_content\"android:layout_width=\"wrap_content\"android:orientation=\"horizontal\"android:layout_marginTop=\"10dp\"><TextViewandroid:layout_width=\"80dp\"android:layout_height=\"wrap_content\"android:text=\"地址\"android:textSize=\"22dp\"android:layout_marginLeft=\"5dp\"/><EditTextandroid:id=\"@+id/address\"android:layout_width=\"190dp\"android:layout_height=\"wrap_content\"android:minLines=\"3\"/></LinearLayout></LinearLayout>
4.message.xml
<?xml version=\"1.0\" encoding=\"utf-8\"?><LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"android:layout_width=\"match_parent\"android:layout_height=\"match_parent\"android:orientation=\"vertical\"><!-- 姓名 --><TextViewandroid:id=\"@+id/name\"android:layout_width=\"match_parent\"android:layout_height=\"wrap_content\"android:text=\"姓名:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5.0dip\"android:layout_marginTop=\"20dp\"/><!-- 单位 --><TextViewandroid:id=\"@+id/danWei\"android:layout_width=\"match_parent\"android:layout_height=\"wrap_content\"android:text=\"单位:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5.0dip\"android:layout_marginTop=\"20dp\"/><!-- 手机号码 --><TextViewandroid:id=\"@+id/mobile\"android:layout_width=\"match_parent\"android:layout_height=\"wrap_content\"android:text=\"手机号码:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5.0dip\"android:layout_marginTop=\"20dp\"/><!-- QQ --><TextViewandroid:id=\"@+id/qq\"android:layout_width=\"match_parent\"android:layout_height=\"wrap_content\"android:text=\"QQ:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5.0dip\"android:layout_marginTop=\"20dp\"/><!-- 地址 --><TextViewandroid:id=\"@+id/address\"android:layout_width=\"match_parent\"android:layout_height=\"wrap_content\"android:text=\"地址:\"android:textSize=\"22dp\"android:layout_marginLeft=\"5.0dip\"android:layout_marginTop=\"20dp\"/></LinearLayout>
5.find.xml
<?xml version=\"1.0\" encoding=\"utf-8\"?><LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"android:layout_width=\"match_parent\"android:layout_height=\"match_parent\"android:orientation=\"vertical\"><LinearLayoutandroid:layout_width=\"match_parent\"android:layout_height=\"wrap_content\"android:orientation=\"horizontal\"><TextViewandroid:id=\"@+id/textView\"android:layout_width=\"match_parent\"android:layout_height=\"50dp\"android:text=\"条件:\"android:textSize=\"20dp\"android:layout_marginRight=\"10dp\"android:layout_marginLeft=\"10dp\"/></LinearLayout><EditTextandroid:id=\"@+id/value\"android:layout_width=\"match_parent\"android:layout_height=\"wrap_content\"android:ems=\"10\"android:inputType=\"textPersonName\"android:text=\"\" /><LinearLayoutandroid:layout_width=\"match_parent\"android:layout_height=\"wrap_content\"android:orientation=\"horizontal\"android:layout_marginTop=\"10dp\"android:layout_gravity=\"center_horizontal\"><Buttonandroid:id=\"@+id/find\"android:layout_width=\"wrap_content\"android:layout_height=\"wrap_content\"android:layout_weight=\"1\"android:text=\"查 询\" /><Buttonandroid:id=\"@+id/cancel\"android:layout_width=\"wrap_content\"android:layout_height=\"wrap_content\"android:layout_weight=\"1\"android:text=\"取 消\" /></LinearLayout></LinearLayout>