且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Android App 的禁用 EditText 中捕获 onclick 事件

更新时间:2022-06-16 06:37:05

在你的 EditText 上设置属性 android:focusable="false"android:enabled="真".并将 OnClickListener 设置为该 EditText.单击该 Edittext 会触发 onClick() 方法,但无法对其进行编辑.我刚试过.

On your EditText set attributes android:focusable="false" and android:enabled="true". And set OnClickListener to that EditText. The click on that Edittext triggers the onClick() method but it can't be edited. I just tried it.