2011-01-17 2 views
0

J'ai un petit problème avec un composant ListView, lorsque je clique sur une ligne, l'application capture l'événement tactile mais la ligne n'est pas focalisée!Problèmes avec ListView

Des idées?

C'est le XML de listview:

<?xml version="1.0" encoding="UTF-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
          android:id="@+id/categoriestab_main" 
          android:orientation="vertical" 
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent" 
          android:background="#FFFFFFFF" 
          > 



        <ListView 
          android:id="@+id/categorieslist" 
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent" 
          android:background="#FFFFFFFF" 
          android:cacheColorHint="#FFFFFFFF" 

        /> 

      </LinearLayout> 

Et ceci est une mise en page d'une seule ligne:

<?xml version="1.0" encoding="UTF-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#FFFFFFFF" 



    > 

     <ImageView 
      android:id="@+id/category_image" 
      android:layout_width="60dp" 
      android:layout_height="40dp" 
      android:src="@drawable/no_foto" 

     /> 

     <TextView 
      style="@style/categories_title" 
      android:id="@+id/category_name" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:singleLine="true" 
      android:layout_toRightOf="@id/category_image" 
      android:layout_centerVertical="true" 
      android:layout_marginLeft="10dp" 
     /> 


</RelativeLayout> 
+0

Voulez-vous un effet de clic sur la ligne, ou voulez-vous changer les lignes bgcolor pour qu'elles apparaissent sélectionnées? – xil3

+0

Le premier, je voudrais l'effet de clic. – pedr0

Répondre

1

Sur votre RelativeLayout, retirez-la background vous avez ajouté et au lieu juste avoir la couleur d'arrière-plan sur ListView. Cette couleur d'arrière-plan bloque l'effet de clic.

+0

Je souhaite vous offrir une grande bière! Merci ! – pedr0

Questions connexes