Android status list, change the background button

When we need to click or select a control, it is checked and unchecked states in different styles, we can use the state list of relevant knowledge.

Sample code is as follows:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@mipmap/aaa"/>
    <item android:drawable="@mipmap/bbb"/>
</selector>

Other state-related as follows

Status Type Explanation Commonly used controls
state_pressed Whether Press Button Button
state_checked Check whether Radio button RadioButton, CheckBox checkbox
state_focused Whether gets focus EditText text edit box
state_selected Check whether Each control can be

 

Guess you like

Origin blog.csdn.net/weixin_38322371/article/details/88992231