Bonjour à tous,

Je suis en train de créer une listView disposant de headers pour différencier les catégories d'items au sein de la liste.
Voici à quoi ressemble un item de la liste :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
 
    <TextView
        android:id="@+id/header"
        style="@style/ContactListSeparatorTextViewStyle"
        android:visibility="gone" />
 
    <LinearLayout
        android:id="@+id/container"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
 
        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" />
 
        <TextView
            android:id="@+id/title2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" />
    </LinearLayout>
 
</LinearLayout>

Dans le code de mon Adapter, j'affiche où non le header.

Mon problème est le suivant :
J'aimerai que lorsque je clic sur un élément de la liste ayant un header, celui ci ne prenne pas le focus.
Je m'explique : Quand je clic, le layout racine (id:root) prend le focus et change son background en bleu. Du coup, le header affiche aussi le background bleu. Or j'aimerai qu'il n'y ai que le layout (id:container) qui change de background.

J'ai trouvé un paramètre "android:descendantFocusability" qui peut être la solution, mais je n'arrive pas au résultat souhaité.

Merci pour celui qui me mettra sur la bonne piste.