【问题标题】:Android ExpandableListView get group number inside bindChildViewAndroid ExpandableListView 在 bindChildView 中获取组号
【发布时间】:2012-01-15 18:10:24
【问题描述】:

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

谢谢!

【问题讨论】:

    标签: android expandablelistview


    【解决方案1】:

    我尝试了另一种使用 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;
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多