如何创建的单击事件在扩展列表中的孩子单击、事件、孩子、列表中

由网友(痛彻心扉)分享简介:我玩弄这个例子。http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.html我无法弄清楚如何将监听器附加到子元素,这样我可以触发一些动作,当用户点击电话号码...

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

我无法弄清楚如何将监听器附加到子元素,这样我可以触发一些动作,当用户点击电话号码。

I cannot figure out how to attach a listener to the children elements so that I can trigger some action when the user taps on the phone number.

任何code或链接将大大AP preciated。

Any code or links would be greatly appreciated.

推荐答案

您需要订阅setOnChildClickListener

getExpandableListView().setOnChildClickListener(this);

和实施OnChildClickListener

and implement 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;
}
阅读全文

相关推荐

最新文章