【发布时间】:2016-02-18 20:05:06
【问题描述】:
嗨,
我想根据我从第一个活动中获得的整数值滚动到第二个活动中的组。
public class Builder extends Activity{
ExpandableListView expandableListView;
Mas_Adapter expandableListAdapter;
List<String> expandableListTitle;
Map<String, List<String>> expandableListDetail;
int grp,chd;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.mas_screen);
expandableListView = (ExpandableListView) findViewById(R.id.list);
Intent intent = getIntent();
grp = intent.getIntExtra("grp", -1);
chd = intent.getIntExtra("chd", -1);
try {
expandableListDetail = CreateMas(grp+1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e("mes", "error in creating data");
}
expandableListTitle = new ArrayList<String>(expandableListDetail.keySet());
expandableListAdapter = new Mas_Adapter(this, expandableListTitle, expandableListDetail);
expandableListView.setAdapter(expandableListAdapter);
expandableListView.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
return true; // This way the expander cannot be collapsed
}
});
}
}
我尝试了 scrollTo、setSelectedGroup 但没有成功。 请帮忙
【问题讨论】:
标签: android scroll expandablelistview