Add a file in the Res/drawable folder, which sets the image trigger status. You can set state_pressed, state_checked, state_pressed, state_selected, state_focused, state_enabled, and other statuses:
Android: state_pressed
Boolean. "True" if this item shocould be used when the object is pressed (such as when a button is touched/clicked); "false" if this item shoshould be used in the default, non-pressed state.
If it is true, the image is displayed when it is clicked. If it is false, it is displayed by default when it is not pressed.
Android: state_focused
Boolean. "True" if this item shocould be used when the object is focused (such as when a button is highlighted using the trackball/D-pad ); "false" if this item shocould be used in the default, non-focused state.
True: The value is displayed when the focus is obtained. False: The default value is displayed when the focus is not obtained.
Android: state_selected
Boolean. "True" if this item shocould be used when the object is selected (such as when a tab is opened); "false" if this item shocould be used when the object is not selected.
True: The image is displayed when it is selected; false: The image is displayed when it is not selected.
Android: state_checkable
Boolean. "True" if this item shocould be used when the object is checkable; "false" if this item shocould be used when the object is not checkable. (only useful if the object can transition between a checkable and non-checkable widget .)
True: The image is displayed when the checkbox function is enabled. False: The image is displayed when the checkbox function is unavailable.
Android: state_checked
Boolean. "True" if this item shocould be used when the object is checked; "false" if it shocould be used when the object is un-checked.
True: The image is displayed when the checkbox is selected; false: The image is displayed when the checkbox is selected.
Android: state_enabled
Boolean. "True" if this item shocould be used when the object is enabled (capable of processing touch/click events); "false" if it shocould be used when the object is disabled.
True: The image is displayed when the component is available; false: The image is displayed when the component is unavailable.
Android: state_window_focused
Boolean. "True" if this item shocould be used when the application window has focus (the application is in the foreground ), "false" if this item shocould be used when the application window does not have focus (for example, if the notification shade is pulled down or a dialog appears ).
True: displays the image when the activity gets the focus at the beginning; false: displays the image when the focus is not at the beginning.
<? 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/button_pressed"/> <! --
Pressed -->
<Item Android: state_focused = "true"
Android: drawable = "@ drawable/button_focused"/> <! --
Focused -->
<Item Android: drawable = "@ drawable/button_normal"/> <! --
Default
-->
</Selector>