0

我有一个 ListFragment,它是我的 ActionBar 中的一个选项卡(其中之一)。问题是没有一个列表元素是可点击的(永远不会调用 onListItemClick())。该元素由两个 TextView 组成。我尝试了许多不同的方法,包括:

android:drawSelectorOnTop="false"
android:textIsSelectable="true" 
android:focusable="false"
android:focusableInTouchMode="false" 
android:clickable="false"

ListFragment 布局:

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>

行项目布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:gravity="center_vertical"
android:orientation="vertical"
android:weightSum="2" >

<TextView
    android:id="@+id/tv_emergency_number_name"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_marginLeft="10dp"
    android:layout_weight="1"
    android:gravity="center_vertical"
    android:textSize="17sp"
    android:textStyle="bold" />

<TextView
    android:id="@+id/tv_emergency_number"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_marginLeft="5dp"
    android:layout_weight="1"
    android:gravity="center_vertical|left"
    android:textSize="15sp" />

</LinearLayout>

你知道它有什么问题吗?

4

0 回答 0