【问题标题】:ExpandableListView - group rows do not react on clicksExpandableListView - 组行不会对点击做出反应
【发布时间】:2013-02-05 09:22:55
【问题描述】:

我有一个 ExpandableListView 和一个 CheckedTextView 作为 grouprow 视图。但我需要减少组之间的间距,所以我把它放在LinearLayout 中。从那时起,列表没有展开,只是对点击没有反应。有任何想法吗?代码如下

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;
}

【问题讨论】:

    标签: android android-listview expandablelistview


    【解决方案1】:

    通过将LinearLayoutCheckedTextView 都设置为不可点击解决了这个问题

    【讨论】:

      猜你喜欢
      • 2018-12-13
      • 1970-01-01
      • 1970-01-01
      • 2017-10-25
      • 1970-01-01
      • 2019-08-23
      • 1970-01-01
      • 1970-01-01
      • 2021-12-26
      相关资源
      最近更新 更多