列表和单个抽屉扩展列表 [英] list and expandable list in single drawer
本文介绍了列表和单个抽屉扩展列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是初学者到Android我需要一些帮助有关在一个抽屉列表和扩展列表
我知道这个问题是张贴在这里的几个时间,但我无法理解,其实我想做出这样的列表:
I am beginner to android I need some Help about List and Extended List in one Drawer I know that this question is posted here several Time but I am unable to understand that Actually I want to make a list like:
请帮我一步一步
thak你!...
Please Help me Step by Step thak you!...
推荐答案
这是 ExpandableListView
本机行为,因此,如果任何项目没有孩子,含蓄不会扩展,但你需要设置 OnClickListener
两组(项目)和儿童(选项):
It's native behavior of ExpandableListView
so if any Item doesn't have children, implicitly won't be expanded but you need to set OnClickListener
for both groups (Items) and children (Options):
public boolean onChildClick(ExpandableListView parent, View row,
int groupPosition, int childPosition, long id) {
// callback method after click for Options
return false;
}
public boolean onGroupClick(ExpandableListView parent, View row,
int groupPosition, long id) {
/** if you are using BaseAdapter subclass implementation **/
adapter.getGroup(groupPosition)).getChildren() == null) {
// item doesn't have children
return true;
}
else {
// has children
return false;
}
这篇关于列表和单个抽屉扩展列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文