Android: Disable EditText in 3 different ways with features comparison

Android: Disable EditText in 3 different ways with features comparison

I have to disable EditText and able to enable EditText again in my app for some reason. So I tried some functions that related to this. There are three different ways I known to disable EditText:

 

1. setEnabled()

 

2. setInputType()

 

3. setFocusable() + setFocusableInTouchMode()

 

</catmee> 文章全部原创、谢绝转载,作者「BianLei」,如果喜欢欢迎分享链接,相关内容参见本站版权声明
本站相关:QQ空间 | 哔哩哔哩 | YouTube ★★★ 打赏:支付宝 ★★★
Tagged . Bookmark the permalink.

COMMENTS: 2

  1. Anonymous says:

    Nice. Good job. Exactly what I was looking for. Too bad Google doesn’t have information as nice and succinct as this.

  2. Alberto Saucedo says:

    setEnable(false) “false” not “true”
    /* EditText is not editable
    * Text will be grayed out
    * Mention that the scroll bar is also become useless
    *

Leave a Reply to Anonymous Cancel reply

Fill up Email address to subscribe reply and display your avatar from Gravatar (If any)
填写邮箱即可显示您在Gravatar的头像