Aim: To know the use of selector and its implementation
-What is Selector
-How to write
-Implementation of Selectors
-How to Apply to Button
What is selector :
Android allows different states of the button to be changed as per the users action to identify
various action getting performed on the Button by modifying it visual appearance .The state are
pressed,selected and Normall the visual representation of these changes is manged through the Selectors .
Selectors are basically xml part of the android project which are written in xml and placed in the drawable folder of the project.
How to write :
Selectors are written in xml and are placed in the draw-able directory of the project.
Implementation of Selectors:
Here in this case
this line will pick the image with name numpad_button_bg_selected n when the state of the button is selected similarly it will work for rest of the states.
This is how you can implement the selector for the button in android it can be implemented in simillar way for image view and imagebutton as well.