带子的ExpandableListView单击片段中的侦听器而不是自定义适配器中的侦听器

时间:2014-04-04 13:24:12

标签: android android-fragments expandablelistview

我想处理我的expandableListView子元素,点击我的片段,我有ExpandableListView。

现在,我在getChildView适配器方法中处理它。如何在Fragment中处理它?<​​/ p>

我试过这个:

     implements ExpandableListView.OnChildClickListener{
        expandableListView.setOnChildClickListener(this);

    ....}

        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int  childPosition, long id) {
            Log.d("enter","enter");
            return false;
        }

但永远不要进入它..

1 个答案:

答案 0 :(得分:0)

在您的片段中,您可以获得对ExpandableListView的引用,然后将OnChildClickListener设置为片段本身。

mExpandableListView.setOnChildClickListener(this);

该片段必须实现ExpandableListView.OnChildClickListener。