最新国产好看的视频,伊人天堂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問題,即: 無法通過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)論

慈利县| 平南县| 沅陵县| 精河县| 龙井市| 蒲城县| 莱阳市| 谢通门县| 武邑县| 穆棱市| 扎赉特旗| 诸城市| 双城市| 东乡| 濮阳县| 饶阳县| 南岸区| 察哈| 依兰县| 宁陕县| 聂拉木县| 清远市| 封丘县| 四会市| 察隅县| 浦江县| 威宁| 巧家县| 毕节市| 荃湾区| 酒泉市| 宁远县| 咸阳市| 福安市| 沅陵县| 博湖县| 东光县| 诸城市| 清镇市| 北碚区| 望谟县|