android各种控件的事件监听及举例

原帖地址:http://www.iteye.com/topic/1060815#

 

下面是各种常用控件的事件监听的使用

①EditText(编辑框)的事件监听---OnKeyListener

②RadioGroup、RadioButton(单选按钮)的事件监听---OnCheckedChangeListener

③CheckBox(多选按钮)的事件监听---OnCheckedChangeListener

④Spinner(下拉列表)的事件监听---OnItemSelectedListener

⑤Menu(菜单)的事件处理---onMenuItemSelected

⑥Dialog(对话框)的事件监听---DialogInterface.OnClickListener()

至于Button的事件监听,可以在上一篇博客中看到。

第一个例子:EditText的事件监听

 

[java] view plain copy
 
  1. <span style="font-size:18px;">package org.hualang.eventtest2;  
  2.   
  3. import android.app.Activity;  
  4. import android.os.Bundle;  
  5. import android.view.KeyEvent;  
  6. import android.view.View;  
  7. import android.widget.EditText;  
  8. import android.widget.TextView;  
  9.   
  10. public class EventTest2 extends Activity {  
  11.     /** Called when the activity is first created. */  
  12.     private TextView mytext;  
  13.     private EditText edittext;  
  14.     @Override  
  15.     public void onCreate(Bundle savedInstanceState) {  
  16.         super.onCreate(savedInstanceState);  
  17.         setContentView(R.layout.main);  
  18.         mytext = (TextView)findViewById(R.id.mytext);  
  19.         edittext = (EditText)findViewById(R.id.edittext);  
  20.         /** 
  21.          * 设置当EditText为空,则提示“请输入账号” 
  22.          * 在配置文件main.xml中可以用android:hint="请输入账号"来实现 
  23.          */  
  24.         edittext.setHint("请输入账号");  
  25.         //下面为EditText事件监听  
  26.         edittext.setOnKeyListener(new EditText.OnKeyListener()  
  27.         {  
  28.   
  29.             @Override  
  30.             public boolean onKey(View arg0, int arg1, KeyEvent arg2) {  
  31.                 //得到文字,显示在TextView中  
  32.                 mytext.setText("内容:"+edittext.getText().toString());  
  33.                 return false;  
  34.             }  
  35.               
  36.         });  
  37.     }  
  38. }</span>  


main.xml

[java] view plain copy
 
  1. <span style="font-size:18px;"><?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:orientation="vertical"  
  4.     android:layout_width="fill_parent"  
  5.     android:layout_height="fill_parent"  
  6.     >  
  7. <TextView    
  8.     android:layout_width="fill_parent"   
  9.     android:layout_height="wrap_content"   
  10.     android:id="@+id/mytext"  
  11.     />  
  12. <EditText  
  13.     android:id="@+id/edittext"  
  14.     android:layout_width="fill_parent"  
  15.     android:layout_height="wrap_content"  
  16.     android:textSize="10pt"  
  17. />  
  18. </LinearLayout></span>  

第二个例子:单选按钮的事件监听处理

 

[java] view plain copy
 
    1. <span style="color:#000000;">package org.hualang.eventtest;  
    2.   
    3. import android.app.Activity;  
    4. import android.os.Bundle;  
    5. import android.view.Gravity;  
    6. import android.widget.RadioButton;  
    7. import android.widget.RadioGroup;  
    8. import android.widget.Toast;  
    9.   
    10. public class EventTest3 extends Activity {  
    11.     /** Called when the activity is first created. */  
    12.     private RadioGroup group;  
    13.     private RadioButton radio1,radio2,radio3,radio4;  
    14.     @Override  
    15.     public void onCreate(Bundle savedInstanceState) {  
    16.         super.onCreate(savedInstanceState);  
    17.         setContentView(R.layout.main);  
    18.           
    19.         group = (RadioGroup)findViewById(R.id.radiogroup1);  
    20.         radio1 = (RadioButton)findViewById(R.id.button1);  
    21.         radio2 = (RadioButton)findViewById(R.id.button2);  
    22.         radio3 = (RadioButton)findViewById(R.id.button3);  
    23.         radio4 = (RadioButton)findViewById(R.id.button4);  
    24.           
    25.         group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {  
    26.               
    27.             @Override  
    28.             public void onCheckedChanged(RadioGroup group, int checkedId) {  
    29.                 // TODO Auto-generated method stub  
    30.                 if (checkedId == radio2.getId())  
    31.                 {  
    32.                     showMessage("正确答案:" + radio2.getText()+",恭喜你,答对了");  
    33.                 }  
    34.                 else  
    35.                 {  
    36.                     showMessage("对不起,虽然很多,但不是公认的最多");  
    37.                 }  
    38.             }  
    39.         });  
    40.     }  
    41.     public void showMessage(String str)  
    42.     {  
    43.         Toast toast = Toast.makeText(this, str, Toast.LENGTH_SHORT);  
    44.         toast.setGravity(Gravity.TOP, 0, 220);  
    45.         toast.show();  
    46.     }  
    47. }  
    48. <strong><span style="font-size:24px;color:#FF0000;">main.xml</span>  
    49. </strong></span><pre name="code" class="java"><?xml version="1.0" encoding="utf-8"?>  
    50. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    51.     android:orientation="vertical"  
    52.     android:layout_width="fill_parent"  
    53.     android:layout_height="fill_parent"  
    54.     >  
    55.     <TextView  
    56.         android:id="@+id/mytextview"  
    57.         android:layout_width="fill_parent"  
    58.         android:layout_height="wrap_content"  
    59.         android:text="哪个城市的美女最多?"  
    60.     />  
    61.     <RadioGroup  
    62.         android:id="@+id/radiogroup1"  
    63.         android:layout_width="wrap_content"  
    64.         android:layout_height="wrap_content"  
    65.         android:orientation="vertical"  
    66.     >  
    67.         <RadioButton  
    68.             android:id="@+id/button1"  
    69.             android:layout_width="wrap_content"  
    70.             android:layout_height="wrap_content"  
    71.             android:text="杭州"  
    72.         />  
    73.         <RadioButton  
    74.             android:id="@+id/button2"  
    75.             android:layout_width="wrap_content"  
    76.             android:layout_height="wrap_content"  
    77.             android:text="重庆"  
    78.         />  
    79.         <RadioButton  
    80.             android:id="@+id/button3"  
    81.             android:layout_width="wrap_content"  
    82.             android:layout_height="wrap_content"  
    83.             android:text="成都"  
    84.         />  
    85.         <RadioButton  
    86.             android:id="@+id/button4"  
    87.             android:layout_width="wrap_content"  
    88.             android:layout_height="wrap_content"  
    89.             android:text="香港"  
    90.         />  
    91.     </RadioGroup>  
    92. </LinearLayout>  
    93. <strong><span style="color:#ff0000;">第三个例子:复选框的事件处理</span></strong>  
    94. package org.hualang.eventtest4;  
    95.   
    96. import android.app.Activity;  
    97. import android.os.Bundle;  
    98. import android.view.Gravity;  
    99. import android.view.View;  
    100. import android.widget.Button;  
    101. import android.widget.CheckBox;  
    102. import android.widget.CompoundButton;  
    103. import android.widget.CompoundButton.OnCheckedChangeListener;  
    104. import android.widget.Toast;  
    105.   
    106. public class EventTest4 extends Activity {  
    107.     /** Called when the activity is first created. */  
    108.     private CheckBox ch1,ch2,ch3,ch4,ch5;  
    109.     private Button mybutton;  
    110.     @Override  
    111.     public void onCreate(Bundle savedInstanceState) {  
    112.         super.onCreate(savedInstanceState);  
    113.         setContentView(R.layout.main);  
    114.           
    115.         mybutton = (Button)findViewById(R.id.mybutton);  
    116.         ch1 = (CheckBox)findViewById(R.id.check1);  
    117.         ch2 = (CheckBox)findViewById(R.id.check2);  
    118.         ch3 = (CheckBox)findViewById(R.id.check3);  
    119.         ch4 = (CheckBox)findViewById(R.id.check4);  
    120.         ch5 = (CheckBox)findViewById(R.id.check5);  
    121.           
    122.         ch1.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener()  
    123.         {  
    124.   
    125.             @Override  
    126.             public void onCheckedChanged(CompoundButton arg0, boolean arg1) {  
    127.                 // TODO Auto-generated method stub  
    128.                 if(ch1.isChecked())  
    129.                 {  
    130.                     showMessage("你选择了"+ch1.getText());  
    131.                 }  
    132.             }  
    133.               
    134.         });  
    135.         ch2.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener()  
    136.         {  
    137.   
    138.             @Override  
    139.             public void onCheckedChanged(CompoundButton arg0, boolean arg1) {  
    140.                 // TODO Auto-generated method stub  
    141.                 if(ch3.isChecked())  
    142.                 {  
    143.                     showMessage("你选择了"+ch2.getText());  
    144.                 }  
    145.             }  
    146.               
    147.         });  
    148.         ch3.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener()  
    149.         {  
    150.   
    151.             @Override  
    152.             public void onCheckedChanged(CompoundButton arg0, boolean arg1) {  
    153.                 // TODO Auto-generated method stub  
    154.                 if(ch3.isChecked())  
    155.                 {  
    156.                     showMessage("你选择了"+ch3.getText());  
    157.                 }  
    158.             }  
    159.               
    160.         });  
    161.         ch4.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener()  
    162.         {  
    163.   
    164.             @Override  
    165.             public void onCheckedChanged(CompoundButton arg0, boolean arg1) {  
    166.                 // TODO Auto-generated method stub  
    167.                 if(ch4.isChecked())  
    168.                 {  
    169.                     showMessage("你选择了"+ch4.getText());  
    170.                 }  
    171.             }  
    172.               
    173.         });  
    174.         ch5.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener()  
    175.         {  
    176.   
    177.             @Override  
    178.             public void onCheckedChanged(CompoundButton arg0, boolean arg1) {  
    179.                 // TODO Auto-generated method stub  
    180.                 if(ch5.isChecked())  
    181.                 {  
    182.                     showMessage("你选择了"+ch5.getText());  
    183.                 }  
    184.             }  
    185.               
    186.         });  
    187.           
    188.         mybutton.setOnClickListener(new Button.OnClickListener()  
    189.         {  
    190.   
    191.             @Override  
    192.             public void onClick(View arg0) {  
    193.                 // TODO Auto-generated method stub  
    194.                 int num = 0;  
    195.                 if(ch1.isChecked())  
    196.                 {  
    197.                     num++;  
    198.                 }  
    199.                 if(ch2.isChecked())  
    200.                 {  
    201.                     num++;  
    202.                 }  
    203.                 if(ch3.isChecked())  
    204.                 {  
    205.                     num++;  
    206.                 }  
    207.                 if(ch4.isChecked())  
    208.                 {  
    209.                     num++;  
    210.                 }  
    211.                 if(ch5.isChecked())  
    212.                 {  
    213.                     num++;  
    214.                 }  
    215.                   
    216.                 showMessage("谢谢参与,您一共选择了"+num+"项");  
    217.                   
    218.             }  
    219.               
    220.         });  
    221.     }  
    222.       
    223.   
    224.       
    225.     public void showMessage(String str)  
    226.     {  
    227.         Toast toast = Toast.makeText(this, str, Toast.LENGTH_SHORT);  
    228.         toast.setGravity(Gravity.TOP, 0, 220);  
    229.         toast.show();  
    230.     }  
    231. }  
    232. <span style="font-size:24px;color:#FF0000;">main.xml</span>  
    233. <?xml version="1.0" encoding="utf-8"?>  
    234. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    235.     android:orientation="vertical"  
    236.     android:layout_width="fill_parent"  
    237.     android:layout_height="fill_parent"  
    238.     >  
    239.     <TextView    
    240.         android:layout_width="fill_parent"   
    241.         android:layout_height="wrap_content"   
    242.         android:text="你喜欢哪些智能手机系统"  
    243.         />  
    244.     <CheckBox  
    245.         android:id="@+id/check1"  
    246.         android:layout_width="fill_parent"  
    247.         android:layout_height="wrap_content"  
    248.         android:text="苹果 ios"  
    249.     />  
    250.     <CheckBox  
    251.         android:id="@+id/check2"  
    252.         android:layout_width="fill_parent"  
    253.         android:layout_height="wrap_content"  
    254.         android:text="谷歌 Android"  
    255.     />  
    256.     <CheckBox  
    257.         android:id="@+id/check3"  
    258.         android:layout_width="fill_parent"  
    259.         android:layout_height="wrap_content"  
    260.         android:text="RIM BlackBerry"  
    261.     />  
    262.     <CheckBox  
    263.         android:id="@+id/check4"  
    264.         android:layout_width="fill_parent"  
    265.         android:layout_height="wrap_content"  
    266.         android:text="微软 Windows phone 7"  
    267.     />  
    268.     <CheckBox  
    269.         android:id="@+id/check5"  
    270.         android:layout_width="fill_parent"  
    271.         android:layout_height="wrap_content"  
    272.         android:text="诺基亚 symbian"  
    273.     />  
    274.     <Button  
    275.         android:id="@+id/mybutton"  
    276.         android:layout_width="fill_parent"  
    277.         android:layout_height="wrap_content"  
    278.         android:text="确定"  
    279.     />  
    280.   
    281. </LinearLayout>  
    282.   
    283. <span style="color:#ff0000;"><strong>第四个例子:Spinner下拉菜单的事件处理</strong></span>  
    284. package org.hualang.eventtest5;  
    285.   
    286. import android.app.Activity;     
    287. import android.os.Bundle;     
    288. import android.view.View;     
    289. import android.widget.AdapterView;     
    290. import android.widget.ArrayAdapter;     
    291. import android.widget.Spinner;     
    292. import android.widget.TextView;     
    293.     
    294. public class EventTest5 extends Activity {     
    295.     /** Called when the activity is first created. */    
    296.     private static final String[] citys={"杭州","北京","成都","大连","深圳","南京"};     
    297.     private TextView text;     
    298.     private Spinner spinner;     
    299.     private ArrayAdapter<String> adapter;     
    300.     @Override    
    301.     public void onCreate(Bundle savedInstanceState) {     
    302.         super.onCreate(savedInstanceState);     
    303.         setContentView(R.layout.main);     
    304.         text=(TextView)findViewById(R.id.text);     
    305.         spinner=(Spinner)findViewById(R.id.spinner);     
    306.              
    307.         //将可选内容与ArrayAdapter连接     
    308.         adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,citys);     
    309.         //设置下拉列表风格     
    310.         adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);     
    311.         //将adapter添加到spinner中     
    312.         spinner.setAdapter(adapter);     
    313.         //添加Spinner事件监听     
    314.         spinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener()     
    315.         {     
    316.     
    317.             @Override    
    318.             public void onItemSelected(AdapterView<?> arg0, View arg1,     
    319.                     int arg2, long arg3) {     
    320.                 // TODO Auto-generated method stub     
    321.                 text.setText("你所在的城市是:"+citys[arg2]);     
    322.                 //设置显示当前选择的项     
    323.                 arg0.setVisibility(View.VISIBLE);     
    324.             }     
    325.     
    326.             @Override    
    327.             public void onNothingSelected(AdapterView<?> arg0) {     
    328.                 // TODO Auto-generated method stub     
    329.                      
    330.             }     
    331.                  
    332.         });     
    333.     }     
    334. }    
    335.   
    336. <span style="font-size:24px;color:#FF0000;">main.xml</span>  
    337. <?xml version="1.0" encoding="utf-8"?>     
    338. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
    339.     android:orientation="vertical"    
    340.     android:layout_width="fill_parent"    
    341.     android:layout_height="fill_parent"    
    342.     >     
    343. <TextView       
    344.     android:id="@+id/text"    
    345.     android:layout_width="fill_parent"      
    346.     android:layout_height="wrap_content"      
    347.     android:text="您所在的城市"    
    348.     />     
    349. <Spinner     
    350.     android:id="@+id/spinner"    
    351.     android:layout_width="wrap_content"    
    352.     android:layout_height="wrap_content"    
    353.     android:layout_centerHorizontal="true"    
    354. />     
    355. </LinearLayout>  
    356.   
    357. <strong><span style="color:#ff0000;">第五个例子:Menu(菜单)的事件处理</span></strong>   
    358. </pre><br>  
    359. <pre name="code" class="java">package org.hualang.eventtest6;  
    360.   
    361. import android.app.Activity;  
    362. import android.os.Bundle;  
    363. import android.view.Menu;  
    364. import android.view.MenuInflater;  
    365. import android.view.MenuItem;  
    366. import android.widget.Toast;  
    367.   
    368. public class EventTest6 extends Activity {  
    369.     /** Called when the activity is first created. */  
    370.     @Override  
    371.     public void onCreate(Bundle savedInstanceState) {  
    372.         super.onCreate(savedInstanceState);  
    373.         setContentView(R.layout.main);  
    374.     }  
    375.   
    376.     @Override  
    377.     public boolean onCreateOptionsMenu(Menu menu) {  
    378.         // TODO Auto-generated method stub  
    379.         MenuInflater inflater = getMenuInflater();  
    380.         //设置menu界面为res/menu/menu.xml  
    381.         inflater.inflate(R.menu.menu, menu);  
    382.         return true;  
    383.     }  
    384.   
    385.     @Override  
    386.     public boolean onMenuItemSelected(int featureId, MenuItem item) {  
    387.         //得到当前选中的MenuItem的ID  
    388.         int itemId = item.getItemId();  
    389.         switch(itemId)  
    390.         {  
    391.         case R.id.apple:  
    392.             Toast toast = Toast.makeText(this, "这是苹果", Toast.LENGTH_SHORT);  
    393.             toast.show();  
    394.             break;  
    395.         case R.id.banana:  
    396.             Toast toast2 = Toast.makeText(this, "这是香蕉", Toast.LENGTH_SHORT);  
    397.             toast2.show();  
    398.             break;  
    399.         case R.id.exit:  
    400.             EventTest6.this.finish();  
    401.             break;  
    402.         }  
    403.         return true;  
    404.     }  
    405.       
    406.       
    407. }</pre><br>  
    408. <span style="font-size:24px; color:#FF0000">main.xml</span><br>  
    409. <?xml version="1.0" encoding="utf-8"?><br>  
    410. <menu xmlns:android="http://schemas.android.com/apk/res/android"><br>  
    411.     <item android:id="@+id/apple"<br>  
    412.         android:title="苹果"<br>  
    413.     /><br>  
    414.     <item android:id="@+id/banana"<br>  
    415.         android:title="香蕉"<br>  
    416.         /><br>  
    417.     <item android:id="@+id/exit"<br>  
    418.         android:title="退出"<br>  
    419.         /><br>  
    420. </menu><br>  
    421. <span style="color:#ff0000"><strong>第六个例子:对话框的事件处理</strong></span><br>  
    422. package org.hualang.dialog;<br>  
    423. <br>  
    424. import android.app.Activity;<br>  
    425. import android.app.AlertDialog;<br>  
    426. import android.app.Dialog;<br>  
    427. import android.app.ProgressDialog;<br>  
    428. import android.content.DialogInterface;<br>  
    429. import android.content.DialogInterface.OnClickListener;<br>  
    430. import android.os.Bundle;<br>  
    431. import android.view.LayoutInflater;<br>  
    432. import android.view.View;<br>  
    433. <br>  
    434. public class MainActivity extends Activity {<br>  
    435.     /** Called when the activity is first created. */<br>  
    436.     ProgressDialog myDialog;<br>  
    437.     @Override<br>  
    438.     public void onCreate(Bundle savedInstanceState) {<br>  
    439.         super.onCreate(savedInstanceState);<br>  
    440.         setContentView(R.layout.main);<br>  
    441.         <br>  
    442.         Dialog dialog = new AlertDialog.Builder(MainActivity.this)<br>  
    443.         .setTitle("登录提示")<br>  
    444.         .setMessage("这里需要登录")<br>  
    445.         .setPositiveButton("确定", new DialogInterface.OnClickListener() {<br>  
    446.             <br>  
    447.             @Override<br>  
    448.             public void onClick(DialogInterface dialog, int which) {<br>  
    449.                 // TODO Auto-generated method stub<br>  
    450.                 LayoutInflater factory = LayoutInflater.from(MainActivity.this);<br>  
    451.                 final View DialogView = factory.inflate(R.layout.dialog, null);<br>  
    452.                 AlertDialog dlg = new AlertDialog.Builder(MainActivity.this)<br>  
    453.                 .setTitle("登录框")<br>  
    454.                 .setView(DialogView)<br>  
    455.                 .setPositiveButton("确定", new DialogInterface.OnClickListener() {<br>  
    456.                     <br>  
    457.                     @Override<br>  
    458.                     public void onClick(DialogInterface dialog, int whichButton) {<br>  
    459.                         // TODO Auto-generated method stub<br>  
    460.                         myDialog = ProgressDialog.show(MainActivity.this, "请等待...", "正在为你登录", true);<br>  
    461.                         new Thread()<br>  
    462.                         {<br>  
    463.                             public void run()<br>  
    464.                             {<br>  
    465.                                 try<br>  
    466.                                 {<br>  
    467.                                     sleep(3000);<br>  
    468.                                 }catch(Exception e)<br>  
    469.                                 {<br>  
    470.                                     e.printStackTrace();<br>  
    471.                                 }finally<br>  
    472.                                 {<br>  
    473.                                     myDialog.dismiss();<br>  
    474.                                 }<br>  
    475.                             }<br>  
    476.                         }.start();<br>  
    477.                     }<br>  
    478.                 }).setNegativeButton("取消",<br>  
    479.                         new DialogInterface.OnClickListener() {<br>  
    480.                             <br>  
    481.                             @Override<br>  
    482.                             public void onClick(DialogInterface dialog, int which) {<br>  
    483.                                 // TODO Auto-generated method stub<br>  
    484.                                 MainActivity.this.finish();<br>  
    485.                             }<br>  
    486.                         }).create();<br>  
    487.                 dlg.show();<br>  
    488.             }<br>  
    489.         }).setNeutralButton("退出", new DialogInterface.OnClickListener() {<br>  
    490.             <br>  
    491.             @Override<br>  
    492.             public void onClick(DialogInterface dialog, int which) {<br>  
    493.                 // TODO Auto-generated method stub<br>  
    494.                 MainActivity.this.finish();<br>  
    495.             }<br>  
    496.         }).create();<br>  
    497.         dialog.show();<br>  
    498.     <br>  
    499.     }<br>  
    500. }<br>  
    501. <span style="font-size:24px; color:#FF0000">xml文件</span><br>  
    502. <?xml version="1.0" encoding="utf-8"?><br>  
    503. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"<br>  
    504.     android:orientation="vertical"<br>  
    505.     android:layout_width="fill_parent"<br>  
    506.     android:layout_height="fill_parent"<br>  
    507.     ><br>  
    508.     <TextView  <br>  
    509.         android:id="@+id/username"<br>  
    510.         android:layout_width="wrap_content" <br>  
    511.         android:layout_height="wrap_content"<br>  
    512.         android:layout_marginLeft="20dip"<br>  
    513.         android:layout_marginRight="20dip" <br>  
    514.         android:text="账号"<br>  
    515.         android:gravity="left"<br>  
    516.         android:textAppearance="?android:attr/textAppearanceMedium"<br>  
    517.     /><br>  
    518.       <EditText<br>  
    519.           android:id="@+id/myusername"<br>  
    520.           android:layout_height="wrap_content"<br>  
    521.           android:layout_width="fill_parent"<br>  
    522.           android:layout_marginLeft="20dip"<br>  
    523.           android:layout_marginRight="20dip"<br>  
    524.           android:scrollHorizontally="true"<br>  
    525.           android:autoText="false"<br>  
    526.           android:capitalize="none"<br>  
    527.           android:gravity="fill_horizontal"<br>  
    528.           android:textAppearance="?android:attr/textAppearanceMedium"<br>  
    529.       /><br>  
    530.       <TextView<br>  
    531.           android:id="@+id/password"<br>  
    532.           android:layout_width="fill_parent"<br>  
    533.           android:layout_height="wrap_content"<br>  
    534.           android:layout_marginLeft="20dip"<br>  
    535.           android:layout_marginRight="20dip"<br>  
    536.           android:text="密码"<br>  
    537.           android:gravity="left"<br>  
    538.           android:textAppearance="?android:attr/textAppearanceMedium"<br>  
    539.       /><br>  
    540.       <EditText<br>  
    541.           android:id="@+id/mypassword"<br>  
    542.           android:layout_width="fill_parent"<br>  
    543.           android:layout_height="wrap_content"<br>  
    544.           android:layout_marginLeft="20dip"<br>  
    545.           android:layout_marginRight="20dip"<br>  
    546.           android:scrollHorizontally="true"<br>  
    547.           android:autoText="false"<br>  
    548.           android:capitalize="none"<br>  
    549.           android:gravity="fill_horizontal"<br>  
    550.           android:password="true"<br>  
    551.       /><br>  
    552. </LinearLayout><br>  
    553. <p></p>  
    554. <pre></pre>  
    555. <strong><span style="color:#ff0000"><br>  
    556. <br>  
    557. </span></strong>  
    558. <p></p>  
    559. <p></p>  
    560. <p><span style="font-size:18px"><br>  
    561. </span></p>  
    562. <p><span style="font-size:18px"><br>  
    563. </span></p>  
    564. <span style="font-size:18px"><br>  
    565. </span><br>  
    566.      
posted @ 2016-11-29 16:04  天涯海角路  阅读(130)  评论(0)    收藏  举报