【问题标题】:Getting item position in childView from expandable listview android从可扩展的listview android获取childView中的项目位置
【发布时间】:2015-06-24 07:05:18
【问题描述】:

我在一行子视图中有多个复选框,如何获取子行中每个复选框的位置,我需要取消选中一个复选框,如果一行中的所有复选框都是

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/child"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <CheckBox
        android:id="@+id/child_check_box"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/ACimageView1"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_below="@+id/child_check_box"
        android:src="@drawable/ic_launcher" />
   <CheckBox
        android:id="@+id/child_check_box33"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/ACimageView2"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_below="@+id/child_check_box"
        android:src="@drawable/ic_launcher" />
     <CheckBox
        android:id="@+id/child_check_box3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/ACimageView3"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_below="@+id/child_check_box"
        android:src="@drawable/ic_launcher" />
    


</LinearLayout>

.

【问题讨论】:

  • 我编辑了我的代码 nair
  • 您真正想要实现什么?你的问题不清楚
  • 我有一个可扩展的列表视图,在子视图中,每个组都有多个复选框。现在我想在子视图中连续获取项目位置

标签: android checkbox expandablelistview


【解决方案1】:

您可以使用它来查找孩子的位置。

 expListView.setOnChildClickListener(new OnChildClickListener() {

    @Override
    public boolean onChildClick(ExpandableListView parent, View v,
            int groupPosition, int childPosition, long id) {


        Log.e("child", (listDataHeader.get(groupPosition)).get(childPosition));

        return false;
    }
});

【讨论】:

  • 我已经尝试过了,但事件没有触发,甚至我将 isChildSelectable 设置为 true;
猜你喜欢
  • 2015-02-16
  • 1970-01-01
  • 1970-01-01
  • 2021-03-10
  • 1970-01-01
  • 2015-02-21
  • 1970-01-01
  • 1970-01-01
  • 2014-09-08
相关资源
最近更新 更多