Survol et sélection d'un Linear LayoutPublié: Mer Avr 25, 2012 3:34 pm
Salut,
comment je peux modifier le background d'un linear layout lors d'un survol de souris et en selection?
J'ai essayé avec le selector mais ca ne marche pas.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Layout1"
android:background="@drawable/fond_rouge"
android:layout_height="match_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Layout2"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="@drawable/back"> |
back.xml
Code:
1 2 3 4 5 6 7 8 9 10
|
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:state_pressed="false"
android:drawable="@android:color/white"
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@android:color/dark" />
</selector> |
Merci de votre aide