1
嗨,
我想滾動到基於整數值,我從我的第一項活動獲得第二個活動組。
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但它沒有工作。 請幫助