android:editable is deprecated: Use an  to make it editable

android:editable is deprecated: Use inputType instead

分析:关于EditText控件的read-only问题,即: 无法通过UI更改其中的内容, 但可以选定部分内容, 进行复制.在早期的sdk, EditText有Editable属性, 现在这个属性已经deprecated了.   解决方法: 其实只需一行代码就能搞定et.setKeyListener(null); 注意, 这里不是setOnKeyListener, 而是setKeyListener. 此方法是TextView的成员, 调用后的效果完全符合预期, 并且获得焦点后不会弹出输入法.    下面是官方文档的解释 Sets the key listener to be used with this TextView. This can be null to disallow user input. Note that this method has significant and subtle interactions with soft keyboards and other input method: see KeyListener.getContentType() for important details. Calling this method will replace the current content type of the text view with the content type returned by the key listener.   Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call setFocusable again after calling this to get the focusability back the way you want it.

 

更多相关文章

  1. ViewFlipper 中文文档
  2. Android实现自定义时钟控件
  3. Activity常见控件三——progressBar
  4. Data Binding的报错集合: 例如Error:(10, 54) 错误: 程序包com.ko
  5. Android(安卓)通过FontPaint计算字符宽
  6. android-基础知识:实现简单的拨打电话功能_intent_study
  7. Android分分钟教你写一个个性化的加载框
  8. 时间和日期选择器DatePicker和TimePicker的使用
  9. android导入项目出现style错误,menu错误

随机推荐

  1. 一种实现ISAIEC 62443操作技术标准的零信
  2. 记一次线程池引发的故障 排查下来是三歪
  3. 选择部署策略
  4. 读研or工作?
  5. 被敖丙用烂的「数据库调优」连招?真香,淦!
  6. Docker容器--安装部署
  7. web前端开发就业前景怎么样?
  8. 流式数据处理在百度数据工厂的应用与实践
  9. 单机训练速度提升640倍!独家解读快手商业
  10. VUE学习之常用指令2