ExpandableListView进去bindChildVie

ExpandableListView进去bindChildVie

本文介绍了Android的ExpandableListView进去bindChildView组号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ExpandableListView用SimpleCursorTreeAdapter。是否有可能获得到当前子属于bindChildView方法内的组号?

I'm using ExpandableListView with a SimpleCursorTreeAdapter. Is it possible to get the group number to which the current child belongs to inside the bindChildView method?

谢谢!

推荐答案

我尝试另一种方法使用getChildView获得组和儿童的位置是:

I tried another approach to obtain group and child position using 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组号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 23:15