Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何单击展开列表视图_Android_Expandablelistview - Fatal编程技术网

Android 如何单击展开列表视图

Android 如何单击展开列表视图,android,expandablelistview,Android,Expandablelistview,如何单击ExpandableListView项并打开新活动 使用此代码 // setOnChildClickListener listener for child row click simpleExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListV

如何单击ExpandableListView项并打开新活动

使用此代码

// 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事件。你…吗?请使用谷歌搜索教程。