本文介绍了在expandablelistview的屏幕顶部移动/滚动单击的listitem视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我单击屏幕顶部移动的扩展组项目时,我看到了SimpleExpandableListAdapter
示例.我创建了NewAdapter
BaseExpandableListAdapter
.我想做同样的事情,但不知道该怎么做.我搜索了很多不适合我的东西.请让我知道该怎么做.谢谢你.
I seen SimpleExpandableListAdapter
example when i clicked expanded group item at moving top of the screen. i created NewAdapter
which extendsBaseExpandableListAdapter
. I want to do same thing but dont know how to do. i searched lot of things which is not worked for me. Please let me know how to do.Thank you in Advance.
推荐答案
这个正在为我工作
expandList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
if (!parent.isGroupExpanded(groupPosition)) {
parent.expandGroup(groupPosition);
} else {
parent.collapseGroup(groupPosition);
}
parent.setSelectedGroup(groupPosition);
return true;
}
});
滚动的主要工作部分是
parent.setSelectedGroup(groupPosition);
这可以解决您的问题.
这篇关于在expandablelistview的屏幕顶部移动/滚动单击的listitem视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!