问题描述
我有一个 EditText,我将其显示为禁用,以便用户无法编辑内容并避免弹出键盘.但现在我想在 EditText 中捕获 onclick 事件并识别正在单击的单个单词.欢迎任何帮助.
I have a EditText which I am presenting as disabled so that user cannot edit the contents and also to avoid popping-up keyboard. But now I want to capture onclick event in the EditText and identify the individual words that are being clicked.Any help is most welcome.
谢谢,巴尔克里希纳.
推荐答案
在你的 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.
这篇关于如何在 Android App 的禁用 EditText 中捕获 onclick 事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!