* EditText自动换行

<EditText     android:layout_width="0dip"    android:layout_height="120dip"    android:layout_margin="10dip"      android:scrollbars="vertical"    android:scrollbarAlwaysDrawVerticalTrack="true"    android:gravity="top"    android:inputType="textCapSentences|textMultiLine"    android:textColor="#000000"     />   

* EditText 密码显示/隐藏

if(pass_show.isChecked()){//显示明文pass.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);}else{//显示密码pass.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);}

* 监听EditText 发生变化

    public void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);          setContentView(R.layout.main);                    text = (EditText)findViewById(R.id.text);          text.addTextChangedListener(textWatcher);      }            private TextWatcher textWatcher = new TextWatcher() {                    @Override            public void afterTextChanged(Editable s) {                 // TODO Auto-generated method stub                 Log.d("TAG","afterTextChanged--------------->");           }                     @Override         public void beforeTextChanged(CharSequence s, int start, int count,                  int after) {              // TODO Auto-generated method stub              Log.d("TAG","beforeTextChanged--------------->");          }            @Override            public void onTextChanged(CharSequence s, int start, int before,                     int count) {                 Log.d("TAG","onTextChanged--------------->");                str = text.getText().toString();              try {                  //if ((heighText.getText().toString())!=null)                   Integer.parseInt(str);                                } catch (Exception e) {                  // TODO: handle exception                  showDialog();              }                                        }                        };   

*默认不获取焦点

在EditText父级加属性

android:focusable="true"   android:focusableInTouchMode="true"

更多相关文章

  1. Android(安卓)Layout: TableLayout
  2. Android(安卓)控件布局常用属性
  3. Android(安卓)控件布局常用属性
  4. Android属性
  5. android多设备界面适配的利器:属性weight的妙用
  6. 常见Theme
  7. android 布局属性
  8. Android(安卓)ScrollView去掉滚动条及ScrollView属性
  9. Android(安卓)ScrollView去掉滚动条及ScrollView属性

随机推荐

  1. php echo什么意思
  2. 如何下载php开源代码
  3. USDT PHP开发包OmniTool简介
  4. php中什么是魔术引号
  5. php如何设置日期
  6. php之日期时间操作一箩筐
  7. wampserver怎么下载
  8. PHP如何实现短网址
  9. php适合做微服务么
  10. php array_chunk函数怎么用