Android 如何单击展开列表视图
如何单击ExpandableListView项并打开新活动 使用此代码Android 如何单击展开列表视图,android,expandablelistview,Android,Expandablelistview,如何单击ExpandableListView项并打开新活动 使用此代码 // setOnChildClickListener listener for child row click simpleExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListV
// setOnChildClickListener listener for child row click
simpleExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
//get the group header using groupPosition);
//get the child info using childPosition);
//display it or do something with it
Toast.makeText(getBaseContext(), " Clicked on :: " + groupPosition
+ "/" + childPosition, Toast.LENGTH_LONG).show();
return false;
}
});
// setOnGroupClickListener listener for group heading click
simpleExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
//get the group header using groupPosition);
//display it or do something with it
Toast.makeText(getBaseContext(), " Header index :: " + groupPosition,
Toast.LENGTH_LONG).show();
return false;
}
});
欢迎来到SO。您可能希望在子项上触发click事件。你…吗?请使用谷歌搜索教程。