android:editableisdeprecated:Usean<EditText>tomakeiteditable

android:editable is deprecated: Use inputTypeinstead

分析:关于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. Android UI属性大解
  2. Android中控件的继承 通用行为和属性
  3. android默认属性
  4. 将Android DHCPInfo 属性转换为int类型(使用BigInteger)
  5. android gravity padding margin 布局属性使用说明

随机推荐

  1. (一)Android数据结构学习之链表
  2. 技术总结--android篇(二)--布局的优化
  3. Android的线程和线程池
  4. Android(安卓)Window类
  5. android gravity用法,我老是记不住
  6. Android(安卓)的提权 (root) 原理是什么?
  7. 利用BLCR加快android的启动过程
  8. Android的API与差异化之路
  9. Linux和Android的区别和联系
  10. 【iOS-Android开发对比】之 数据存储