2012-10-21 11 views
6

Ich habe ein FrameLayout der i Vordergrund ziehbar für sie über die Wähler bewerben will, ich versuche, „drawSelectorOnTop“ zu implementieren, aber für ein einfaches LayoutFrameLayout Vordergrund mit Selektoren

jetzt der Wähler gilt nicht, wenn die Presse Benutzer "state_pressed"

hier ist mein Code:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:foreground="@drawable/cell_background_selector" > 

    <RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 

     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#282828" 
     android:paddingBottom="5dp" > 
.. 
...... 
........ 
</RelativeLayout> 
</FrameLayout> 

hier ist mein Wähler Code:

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <item android:drawable="@drawable/video_blank" android:state_pressed="true"/> 
    <item android:drawable="@drawable/fav_show"/> 
</selector> 

beiden Bilder existieren, aber die FrameLayout immer den Normalzustand ziehbar als

Antwort

12

Alte Frage Vordergrund gelten, aber es war der erste Treffer bei Google, wenn ich ein ähnliches Problem aufgetreten.

Haben Sie einen OnClick-Listener für das FrameLayout? Wenn nicht, wird der gedrückte Zustand niemals verwendet.