问题:android:editable is deprecated: Use an to make it editable
 
意思:Android的:编辑是反对:使用<</span> EditText >对其编辑
分析:关于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.

android:editable is deprecated: Use an <EditText> to make it editable的更多相关文章

  1. 安卓onTextChanged参数解释及实现EditText字数监听 Editable使用

    原作者部分修改部分 补充部分 补充部分2 补充部分3 补充部分4 Editable 尊重原作者:此篇文章是借鉴原作者地址 的博文 并进行修改和增加补充说明,我只是补充和修改: 我感觉这篇文章经过我的补 ...

  2. The android command is deprecated

    新版的SDK tools中的android命令已经不支持 android create project,用起来很不顺手. The "android" command is depr ...

  3. Android图文混排-实现EditText图文混合插入上传

    前段时间做了一个Android会议管理系统,项目需求涉及到EditText的图文混排,如图: 在上图的"会议详情"中.须要支持文本和图片的混合插入,下图演示输入的演示样例: 当会议 ...

  4. 50个Android开发技巧(09 避免用EditText对日期进行验证)

    我们都知道,在表单中对数据进行验证不但无聊并且easy出错. (原文地址:http://blog.csdn.net/vector_yi/article/details/24424713) 想象一下,一 ...

  5. android 随着认识的去除率EditText(它配备了防抖效果)

    Android它没有提供的类似至ios自带的输入框效果清晰(ios简单地只加属性可实现).因此,Android其中 我们要如何实现就需要这种效果用自己的定义的控件实现. 思路:能够使用一个Linear ...

  6. 在android中如何通过点击edittext之外的部分使软键盘隐藏

    我们知道在android中点击edittext框就会自动弹出软键盘,那怎么通过点击edittext之外的部分使软键盘隐藏呢?(微信聊天时的输入框就是这个效果,这个给用户的体验还是很不错的) 首先我们要 ...

  7. Android开发 解决AlertDialog中的EditText无法调出输入法的问题

    在AlertDialog中使用自定义的View,如果View中有EditText,在上面点击,默认是跳不出软键盘的,不是焦点的问题.解决方法,有两种,一是把AlertDialog换成Dialog,但这 ...

  8. Android 入门(2)修改EditText下划线颜色 / 隐藏标题栏

    1 添加颜色 colors.xml中增加 <color name="colorRed">#FF3300</color> 2 添加style styles.x ...

  9. Android中软键盘展示、EditText焦点获取及windowSoftInputMode属性探究

    2017-08-14 21:44:23 有很多中情况,分别展示. 1.Activity不做任何设置,布局使用LinearLayout 会自动滚动EditText之上的所有View,代码: <?x ...

随机推荐

  1. Xcode8中添加SnapKit框架报错,编译失败

    既然SnapKit的作者说SnapKit已经支持Swift3.0了,那么我们就先来适配SnapKit,首先用Xcode8新建一个空项目,利用Cocoapods导入SnapKit. Podfile  打 ...

  2. iOS页面间传值的六种方式

    一般ios页面间的传值方式分为6种:1.属性传值:2.block:3.delegate:4.UserDefault:5.单例:6.通知. 0&1.block 先说我最常用的block吧,属性传 ...

  3. robotium和appium的一些区别

    Appium是基于UIAutomator框架实现的.Appium测试进程与目标应用进程是分开的,所以Appium不能直接访问目标应用的各种element属性进行copy&paste,而只能模拟 ...

  4. onmousedown活用之鼠标拖动

    这个布局蛮简单的就是一个div块,通过定位,固定位置 <html> <head> <meta charset="UTF-8"> <titl ...

  5. Win7的64位系统如何搭建安卓Android开发环境

    在搭建安卓Android开发环境,那么现在比较主流的Win7的64位操作系统如何搭建呢?其实很简单,不需要设置任何环境变量,只需要下载两个程序包(ADT和JDK),下载的时候注意选择相应的64位程序包 ...

  6. DLNA

    DLNA最早由索尼.英特尔.微软等提出,全称是DIGITAL LIVING NETWORK ALLIANCE,旨在解决个人PC,消费电器,移动设备在内的无线网络和有线网络的互联互通,其实就是解决电脑和 ...

  7. The server instance Witness rejected configure request; read its error log file for more information. The reason 1427, and state 31, can be of use for

    数据库服务器做了镜像之后,发现有错误信息 The server instance Witness rejected configure request; read its error log file ...

  8. mysql 准则 杂谈

    转自 刘智慧的文章 1.尽量不要在数据库做运算,复杂运算移到程序段cpu,竟可能简单运用mysql 2.控制单表数据量, 库表控制300---400,单表字段控制20---50个,单表1G或500W行 ...

  9. VS2008中Run-Time Check Failure #2 - Stack around the variable 'xxx' was corrupted 错误解决方法

    问题 : 在用VS2008写一段代码,算法都没有问题,但是调试的时候发现出了main之后就报 Stack around the variable 'xxx' was corrupted 的错误,后来发 ...

  10. Apache Shiro 认证过程

    3.1.1    示例 Shiro验证Subjects 的过程中,可以分解成三个不同的步骤: 1. 收集Subjects 提交的Principals(身份)和Credentials(凭证): 2. 提 ...