我完美地开发了ExpandableListView。
在我的ExpandableListView中有五个组。加载第一次然后崩溃所有五组。这是默认的。
现在我的问题是加载第一次expandablelistview当时2组扩展,其他3组崩溃。
所以请指导我该怎么办?
现在我得到了解决方案,它将完美地工作..请使用此..
ExpandableListView Exlist;
Exlist.expandGroup(0);
Exlist.expandGroup(1);
我根据Nikhil的answer制作了这个片段。认为其他人也可能觉得它很有用。仅在使用BaseExpandableListAdapter时才有效。 ELV
ExpandableListView elv = (ExpandableListView) findViewById(R.id.elv_main);
elv.setAdapter(adapter);
for(int i=0; i < adapter.getGroupCount(); i++)
elv.expandGroup(i);
这是一个完美的解决方案,它会自动增加
ExpandableListView elv = (ExpandableListView) findViewById(R.id.elv_main);
elv.setAdapter(adapter);
for(int i=0; i < adapter.getGroupCount(); i++)
elv.expandGroup(i);
但这是基于项目位置
ExpandableListView Exlist;
Exlist.expandGroup(0);// first item of listview
Exlist.expandGroup(1);//second item of listview
扩展可扩展列表视图的完美解决方案
ExpandableListAdapter expandableListAdapter;
ExpandableListView expandableListView;
expandableListView.expandGroup(0);
expandableListView.expandGroup(1);
expandableListAdapter.notifyDataSetChanged();