设置EditText可点击但是不可编辑

背景:

      有个文本编辑框,内容是根据其他地方输入后,自动填充的,但是希望点击这个输入框时仍然能触发点击事件。 但是采用了android:enabled="false",则不可编辑,也不可点击。

解决方案:      

android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"

或者java代码设置:

editText.setCursorVisible(false);
editText.setFocusable(false);
editText.setFocusableInTouchMode(false);

猜你喜欢

转载自blog.csdn.net/yinxing2008/article/details/82379697
今日推荐