ExpandableListView - 组行不会对点击作出反应

时间:2013-02-05 09:22:56

标签: android android-listview expandablelistview

我有一个ExpandableListViewCheckedTextView为群视图。但我需要减少组之间的间距,所以我把它放在LinearLayout内。从那以后,List没有扩展,只是对点击没有反应。有任何想法吗?代码低于

grouprow.xml

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/holder"
android:clickable="true"
android:orientation="vertical">
<CheckedTextView 

android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-13dp"
android:layout_marginBottom="-13dp"
android:text="@string/hello_world"
android:paddingLeft="20dp"
android:textColor="#FFFFFF"
android:textSize="60sp"
android:includeFontPadding="false"
android:textStyle="bold" />
 </LinearLayout>

获取群组视图:

       @Override
public View getGroupView(int groupPosition, boolean isExpanded,
        View convertView, ViewGroup parent) {
    if (convertView == null) {

        convertView = minflater.inflate(R.layout.grouprow, null);
    }
    LinearLayout holder = (LinearLayout) convertView;
    CheckedTextView txtGr = (CheckedTextView)    holder.findViewById(R.id.textView1);
    txtGr.setText(groupItem.get(groupPosition));
    txtGr.setChecked(isExpanded);
    font = Typeface.createFromAsset(activity.getAssets(),
            "uww.otf");
    txtGr.setTypeface(font);
    return convertView;
}

1 个答案:

答案 0 :(得分:0)

通过将LinearLayoutCheckedTextView设置为不可点击

来解决问题