在ExpandableListView中检查Firstvisible项是Groupindicator?

时间:2011-11-08 13:17:58

标签: android android-layout

是否可以找到ExpandableListView中的第一个可见项是GroupIndicator视图还是下面的childView?请帮忙

提前感谢

1 个答案:

答案 0 :(得分:2)

最后设法做到了这一点

int firstVisibleItem =  mExpListView.getFirstVisiblePosition();

long data = mExpListView.getExpandableListPosition(firstVisibleItem);
int type = mExpListView.getPackedPositionType(data);
if (type ==    ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
    Log.i("info", "childindicator");
}else
    Log.i("info", "groupindicator");