2012-10-21 7 views
6

Mam FrameLayout który chcę zastosować pierwszoplanowy rozciągliwej do niego poprzez selektor, staram się realizować „drawSelectorOnTop”, ale na prosty układFrameLayout planie z selektorów

teraz selektor nie ma zastosowania, gdy użytkownik naciśnie "state_pressed"

tutaj jest mój kod:

<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> 

tutaj jest mój kod selektor:

istnieć
<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> 

oba obrazy, ale FrameLayout zawsze zastosować normalną rozciągliwej państwa jako pierwszego planu

Odpowiedz

12

Stare pytanie, ale był pierwszym hitem w Google, kiedy napotkał podobny problem.

Czy masz zestaw wykrywający OnClick dla FrameLayout? Jeśli nie, wciśnięty stan nigdy nie zostanie użyty.

Powiązane problemy