最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android中EditText實(shí)現(xiàn)不可編輯解決辦法

 更新時(shí)間:2014年12月30日 10:45:50   投稿:hebedich  
這篇文章主要介紹了Android中EditText實(shí)現(xiàn)不可編輯解決辦法,需要的朋友可以參考下

android:editable is deprecated: Use an <EditText> to make it editable
android:editable is deprecated: Use inputType instead

分析:關(guān)于EditText控件的read-only問(wèn)題,即: 無(wú)法通過(guò)UI更改其中的內(nèi)容, 但可以選定部分內(nèi)容, 進(jìn)行復(fù)制.在早期的sdk, EditText有Editable屬性, 現(xiàn)在這個(gè)屬性已經(jīng)deprecated了.
 
解決方法:
其實(shí)只需一行代碼就能搞定et.setKeyListener(null);
注意, 這里不是setOnKeyListener, 而是setKeyListener. 此方法是TextView的成員, 調(diào)用后的效果完全符合預(yù)期, 并且獲得焦點(diǎn)后不會(huì)彈出輸入法.
 
下面是官方文檔的解釋

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.

相關(guān)文章

最新評(píng)論

六枝特区| 永城市| 鄂伦春自治旗| 定结县| 宁津县| 原平市| 扶余县| 涿鹿县| 柏乡县| 缙云县| 茌平县| 华阴市| 长子县| 仙桃市| 桓台县| 吉林省| 夏邑县| 志丹县| 新泰市| 汉川市| 即墨市| 济宁市| 板桥市| 邯郸市| 襄城县| 秦安县| 定兴县| 嘉义县| 霍林郭勒市| 乐陵市| 仙居县| 隆化县| 余庆县| 嘉峪关市| 呼和浩特市| 高碑店市| 布拖县| 固阳县| 同心县| 子洲县| 汝阳县|