My question is: Is it possible to apply a paintable resource to a TextView in a ListView that forces it to retain its background color after the user lifts his finger F TextView?
Consider:
- User selects an item in a ListView
- List item highlights
- User removes his finger from the object.
- The item is no longer highlighted.
My question is, can I let the object remain selected in step 4? I am currently using a list of states designed for my list items. I tried
android:state_focused="true"
android:state_selected="true"
android:state_check="true"
Thank you in advance:)
Edit
solved. I achieved this through java code. For those who wish, I did the following:
An integer variable "previous" has been declared to preserve the previous index, starting from 0 for the first element, and force it to be selected through setBackground ().
Then, in the onItemClickListener for the list, I simply clear the selection of the previous item, select the current one and set the “previous” to the index of the currently selected item.
I don’t know how I did not think about it before xD. I usually have a good understanding of problem solving.
Happens to all of us at some point, I think: P
source share