At the moment I have 3 TextViews, and I want the two others to change their background when they click on any of them separately. I can do this programmatically by registering OnClickListener, or I can make my own selector for each TextView. But I would like to somehow combine this ..

Those. do something like this for several views at once, but in one selector:

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/red_corners_selected"/> <item android:state_pressed="false" android:drawable="@drawable/red_corners_unselected"/> </selector> 
  • Do you need to imitate a click or just change the background? Try one click to perform performClick () on others. - Android Android
  • mimic click. In the future, I plan to add some more logic - Snuf

0