如何在可扩展列表中为子项的click事件创建

use*_*164 6 events android listener

我正在玩这个例子. http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.html

我无法弄清楚如何将一个监听器附加到子元素,以便我可以在用户点击电话号码时触发一些操作.

任何代码或链接将不胜感激.

Pen*_*m10 20

您需要订阅setOnChildClickListener

getExpandableListView().setOnChildClickListener(this);
Run Code Online (Sandbox Code Playgroud)

并实现OnChildClickListener

@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
        int childPosition, long id) {
    // use groupPosition and childPosition to locate the current item in the adapter
    return true;
}
Run Code Online (Sandbox Code Playgroud)