ListView issues
I have an little issues with an ListView component, when I click on a row the Application capture the touch event but but the row isn't focused!
Any ideas?
This is the XML of 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"
>
<Li开发者_如何学JAVAstView
android:id="@+id/categorieslist"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFFFF"
android:cacheColorHint="#FFFFFFFF"
/>
</LinearLayout>
And this is a layout of a single row:
<?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>
On your RelativeLayout, remove the background
you have added and instead just have the background color on the ListView. That background color is blocking the click effect.
精彩评论