Android Selectors

Android selectors can be used to give your Buttons or images the feeling that they are being pressed. Essentially, a selector defines a different drawable for different states of an image or Button. Selector files should reside in the /res/drawable/ folder in your project. Here’s what a basic selector looks like:


If this XML resided in /res/drawable/imagebutton_selector, for example you’d set the android:src attribute of your button to android:src=”@drawable/imagebutton_selector”.