Android Selector全解

 


android:state_window_focused="true"  
android:state_enabled="true" 
android:state_checkable="true" 
android:state_checked="true" 
android:state_selected="true" 
android:state_pressed="true"                                                                     
android:state_activated="true" 
android:state_active="true" 
android:state_single="true" 
android:state_first="true" 
android:state_middle="true" 
android:state_last="true" 
android:state_accelerated="true" 
android:state_hovered="true" 
android:state_drag_hovered="true"
 android:state_drag_can_accept="true" 
android:state_accessibility_focused="true" 
android:drawable="@drawable/icon"
 /> 
  

接下来,给出部分使用场景
   
 
  
      
  
     
  
   
  
  
  
     
  
     


当然我们也可以这样




    

    

    

    


或者这样




    

        

        

            

            

            

            

        

    

    

        

        

            

            

            

            

        

    
    默认背景

这里我们给出重点提醒selector  一般用于background
不要忘记
android:background="@drawable/you_drawable_xml_name"


你可能感兴趣的:(android开发)