Android ExpandableListView获取bindChildView内的组号

标签 android expandablelistview

我将 ExpandableListView 与 SimpleCursorTreeAdapter 一起使用。在bindChildView方法中是否可以获取当前子进程所属的组号?

谢谢!

最佳答案

我尝试了另一种方法来使用 getChildView 获取组和子位置:

    @Override
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        ImageButton ib=null;

        View v = super.getChildView(groupPosition, childPosition,isLastChild, convertView, parent);
        ib=(ImageButton)v.findViewById(R.id.delete);

        ib.setTag(R.id.TAG_GROUPPOS, groupPosition);
        ib.setTag(R.id.TAG_CHILDPOS, childPosition);

        return v;
    }

关于Android ExpandableListView获取bindChildView内的组号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8872056/

相关文章:

android - 将 ListView 的列表项拖放到另一个 ListView 的列表项

android - 我可以 bundle 一个二进制实用程序并从应用程序调用它吗?

android - 从任何营销网站引用时,如何在 android 中启动主要 Activity 时获取 utm 变量?

Android ExpandableListView 不会在返回 LinearLayout 或 View 时展开

android - 使用android espresso访问自定义可扩展列表中的 child

android - ExpandableListview组指标问题

android - 安装 ADT 插件 17

android - 键盘在 WebView 中隐藏/显示

android - 按下 "Run"时如何防止Android Studio打开LogCat(选项卡)?

android - ExpandableListView 上的向下滑动效果