I have some textViews in my LinearLayout.
They are clickable and I would like to make them onClick like for a ListView.
For the listView, when the user clicks an item, the background becomes green I think.
I know that i can do this manually with
tv.SetBackgroundColor(Color.GREEN);
But is there something automaticaly to do this, like for the listView where the selection is managed automaticaly.
Thank you.
You need to define the background as a new XML file containing a list of states.
http://developer.android.com/guide/topics/resources/color-list-resource.html
For example, create a file called background_states.xml in your drawable folder and write something like this:
Then define this new file as background in your TextView:
See the link above for more information about the different states.