添加监听子节点的扩展列表项目 [英] Adding listener to child nodes in Expandable List Item
问题描述
我用的教程给予code
http://mylifewithandroid.blogspot.com/2010/12/expandable -list和 - checkboxes.html
我重视的ExpandableListView的图像
I have used a code given in tutorial http://mylifewithandroid.blogspot.com/2010/12/expandable-list-and-checkboxes.html I have attached an image of the ExpandableListView
SimpleExpandableListAdapter expListAdapter =
new SimpleExpandableListAdapter(
this,
createGroupList(),
R.layout.child_row,
new String[] { "CityName" },
new int[] { R.id.childname },
createChildList(),
R.layout.child_row,
new String[] { "citydetails", "city" },
new int[] { R.id.childname, R.id.city}
);
setListAdapter( expListAdapter );
我需要关于如何监听器添加到各个子节点例如点击地址应该将用户到另一个活动的一些code例子。
期待你的回复。
谢谢。
I need some code example on how to add listeners to individual child nodes for example clicking on Address should take the user to another activity. Looking forward to your reply. thanks.
推荐答案
您也可以有你的活动覆盖了onChildClick方式:
You can also have your activity override the the onChildClick method:
@Override
public boolean onChildClick(ExpandableListView expandableListView, View view, int groupPosition, int childPosition, long id) {
//implement logic to start the appropriate activity for this child.
}
从Android开发人员网站:<一href=\"http://developer.android.com/reference/android/widget/ExpandableListView.OnChildClickListener.html\"相对=nofollow> onChildClick 。
I also recommend downloading the API Demos. You can learn more on setting it up here.
这篇关于添加监听子节点的扩展列表项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!