Android中EditText设置editable属性为不可编辑的问题
2015-06-11 14:25
459 查看
EditText的editable属性用于设置是否可被编辑,但目前已被deprecate,相关文档说用inputType属性替代,但实际上似乎又无效果,可能是个bug。
只能寻求其他方式实现EditText不可编辑的效果了。虽然editable还是可以运行。
android:editable="false"should work, but
it is deprecated, you should be using
android:inputType="none"instead.
[/code]
editableis deprecated (since API level 3). You should instead be using
inputType(with the value
none).
android:editable is deprecated. android:inputType="none" should be used instead but it contains bug and it does not work.
<EditText ... android:clickable="false" android:cursorVisible="false" android:focusable="false" android:focusableInTouchMode="false"> </EditText>
EditText editText;
editText.setKeyListener(null);
will work but it just not listening to keys.
User can see a cursor on the edittext.
You can try
editText.setEnabled(false);
相关文章推荐
- Android service通过aidl 回调客户端 daemon
- androidstudio设置项目编码
- 屏幕分辨率
- #提高Android Studio流畅度
- Android快速开发框架——AndroidAnnotations(Code Diet)
- Android中layout_weight属性设置规则
- Android Fragment 真正的完全解析(上)
- Android详细笔记
- Android NDK开发之 Android系统开发中LOG的使用
- AndroidManifest.xml的解析
- Android多国语言的国家代码清单大全
- 【Android】Tab页的实现,利用tabhost
- 【Android】Tab页的实现,利用tabhost
- Android 编程下 Touch 事件的分发和消费机制
- 在android里保存数据的三种形式(Saving Data)
- 【Android】九宫格的实现
- 【Android】九宫格的实现
- android 调用摄像头拍照
- 电脑通过android中的telnet服务远程访问
- Android 动态设置TextView drawableLeft的方式