问什么selector没有出现效果?求大神 啊
调用的时候:android:background="@drawable/selector"<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="false" 
    android:state_selected="true" 
    android:state_pressed="false" 
    android:drawable="@drawable/tab_btn_bg_f" />
    <item android:state_focused="true" 
        android:state_selected="false" 
        android:state_pressed="false" 
        android:drawable="@drawable/tab_btn_bg_f" />
    <item android:state_focused="true" 
        android:state_selected="true" 
        android:state_pressed="false" 
        android:drawable="@drawable/tab_btn_bg_f" />
    <item android:state_pressed="true" 
        android:drawable="@drawable/tab_btn_bg_f" />
   <item android:drawable="@drawable/tab_btn_bg"/></selector>

解决方案 »

  1.   

    没效果是只显示tab_btn_bg_f这张还是tab_btn_bg这张?写这么复杂真心用的着么?
      

  2.   

    tab_btn_bg 这张背景显示正常
    就是点击时候,tab_btn_bg_f 不显示
    求指导...............
      

  3.   

    最简单的,
      <?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/spinner_dropdown_pressed" /> 
      <item android:state_focused="true" android:drawable="@drawable/spinner_dropdown_pressed" /> 
      <item android:drawable="@drawable/spinner_dropdown_normal" /> 
      </selector>
    这样试试
      

  4.   


    tab_btn_bg这张显示正常,点击后想显示tab_btn_bg_f,显示不出来,
      

  5.   


    这样还是不行啊,
    我是自定义了一个tabHost,为什么不出来啊,,,求大神啊,
      

  6.   

    android:background="@drawable/selector"你这句是写在哪个控件下的?
      

  7.   

    <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent">
    <RelativeLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
    <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent"/>
    <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/selector" android:layout_alignParentBottom="true"></TabWidget>
    </RelativeLayout>
    </TabHost>
      

  8.   

     <?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/spinner_dropdown_pressed" />  
      <item android:state_focused="true" android:drawable="@drawable/spinner_dropdown_pressed" />  
      <item android:drawable="@drawable/spinner_dropdown_normal" />  
      </selector>这个XML是叫selector.xml吗?
      

  9.   


    在drawable里,是叫selector.xml
    <item android:drawable="@drawable/spinner_dropdown_normal" /> 默认背景这个都正常显示就是按键和焦点那两个没效果,