Android开发:设置文本输入框是否可编辑

Android开发在layout配置文件中添加一个EditText:

1 <EditText 
2         android:id="@+id/view_eqpt_id"
3         android:layout_width="fill_parent"
4         android:layout_height="wrap_content"
5         android:inputType="text"
6         android:editable="false" />

最后一行提示:android:editable is deprecated: Use inputType instead,原来editable属性已经过时,google不再建议用户使用,可以用inputType属性代替,但是inputType属性值列表中并没有表示不可编辑的,经过多次尝试,发现可以用android:focusable设置:

1 <EditText 
2         android:id="@+id/view_eqpt_id"
3         android:layout_width="fill_parent"
4         android:layout_height="wrap_content"
5         android:inputType="text"
6         android:focusable="false" />

 

posted @ 2013-05-13 15:34  码园小农  阅读(3022)  评论(0编辑  收藏  举报