Add onClickListener to Default GroupIndicator in ExpandableListView

I am using an extensible list view. In my application, the group and the child have content. So I need to get started with groupClicked, as well as with the click of a Child button. As the default action (set in android), when I click on a group, the group expands.

I want to add an action to the group indicator button. Thus, when the group is pressed, the action will begin, and when the group indicator button is pressed, the child will be shown.

> a group child 1 child 2... 

How can i do this?

thanks

+6
source share
4 answers

as far as I know, it’s not possible to add any default button action for an extensible list.

+2
source

you can set the groupIndicator parameter to null, and then add the button to the group layout and process everything you want on the onclicklistener button

this link can help you handle multiple listeners in a single list item

CustomListView Example

and this one for ExpandableListView:

ExpandableListView Example

+1
source

Use the "findviewbyId" call identifier of the group and child group in activity. Generate group and child group listviews in string.xml. Using onClickListener, we can show the group and child group

0
source

The following listener will start when the user clicks / points to an indicator:

 expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { // add your code here ... return true; } }); 
0
source

Source: https://habr.com/ru/post/908511/


All Articles