作者:为谁落慕 | 来源:互联网 | 2023-09-03 22:14
Socurrently,Iamtryingtocreateaselectedstateforthreetextviews所以目前,我正在尝试为三个textview创建一个选定
So currently, I am trying to create a selected state for three textviews
所以目前,我正在尝试为三个textview创建一个选定状态
Currently, for each of the textviews ( H M S) the text is red:
目前,对于每个文本视图(H M S),文本为红色:
However, when tap the H M or S I want it to turn another color--white.
但是,当点击H M或S时我想让它变成另一种颜色 - 白色。
So I tried to follow this:
所以我试着遵循这个:
Android - Textview change color on changing of state
Android - Textview在改变状态时改变颜色
and I did this (selected_text.xml):
我这样做了(selected_text.xml):
and applied that:
并应用:
However, the textviews do not change color after I click on them.
但是,单击后文本视图不会更改颜色。
How do I fix this?
我该如何解决?
Also, I was wondering if it is better to implement this in java code since I need to perform a different function after each textview is clicked/highlighted. If so, how can that be implemented?
另外,我想知道在java代码中实现它是否更好,因为我需要在每个textview被单击/突出显示后执行不同的功能。如果是这样,如何实施?
1 个解决方案