文本视图不可见性
我有一个 textView,其中我在 xml 中将颜色设置为透明
android:background="#ffffff"
现在我已经编写了代码来更改 textView onClick 的图像
t1.setBackgroundResource(R.drawable.fslash);
,但它似乎没有对 textView 的 onClick 执行任何操作。
请帮忙
I have a textView in which i have set the color as transparent in xml
android:background="#ffffff"
Now i have written the code to change the image of the textView onClick
t1.setBackgroundResource(R.drawable.fslash);
but it does not seem to do anything onClick of the textView.
Please help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你必须像这样实现 click 方法
You have to implement click method like this
试试这个,
try this,
尝试设置:
或
您也可以在 XML 中执行以下操作:
try setting:
or
you can also do in XML:
如果你想点击TextView,你必须将clickable属性设置为true。否则它不会听任何点击!您可以在代码或 xml 文件中执行此操作:
代码:
t1.setClickable(true);
XML:
android:clickable="true"
If you want to click on the TextView, you have to set the clickable attribute to true. Otherwise it will not listen to any click! You can do that in code or in the xml file:
Code:
t1.setClickable(true);
XML:
android:clickable="true"