Control state profile instance for Android programming

  • 2020-12-21 18:09:58
  • OfStack

An example of the control state configuration file for Android programming is presented. To share for your reference, the details are as follows:


<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <!--  There is no state  -->
  <item
    android:state_focused="false"
    android:state_selected="false"
    android:state_pressed="false"
    android:state_enabled="true"
    android:drawable="@drawable/blue" />
  <!--  selected  -->
  <item
    android:state_focused="false"
    android:state_selected="true"
    android:state_pressed="false"
    android:state_enabled="true"
    android:drawable="@drawable/blue" />
  <!--  Get focus  -->
  <item
    android:state_focused="true"
    android:state_selected="false"
    android:state_pressed="false"
    android:state_enabled="true"
    android:drawable="@drawable/blue" />
  <!--  The state of being pressed  -->
  <item
    android:state_focused="false"
    android:state_selected="false"
    android:state_pressed="true"
    android:state_enabled="true"
    android:drawable="@drawable/blue" />
</selector>

I hope this article has been helpful in Android programming.


Related articles: