Suppose there are 2 ImageButtons.Now, to display the image based on its state, I should write a selector xml for each of the ImageButton. Can we write a same selector for both the views.Because my app have a lot of buttons and have to write a selector xml for each of the view. Can we optimize it?
Share
if you you try it with xml file then you must create each selector for each button.
So try to do dynamically either by subclassing the StateListDrawable or try the below code which creates selector dynamically:::