Can I have multiple onClickListeners for the same expandableListView?
I have an onClickListener
sucessfully set up for my custom ExpandableListView
elv.setOnChildClickListener(new OnCh开发者_开发问答ildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
}
);
Can I have a onGroupClickListener
somewhere in the same class too?
Can I have multiple onClickListeners for the same expandableListView?
Short answer: No.
You could:
Have the one child click listener do many things.
Design your own custom listener system for registering custom listeners. Register custom listeners in your custom listener system. Have the one child click listener of the ExpandableListView tell the custom listener system to iterate through all of its listeners and notify them of the event.
Can I have a onGroupClickListener somewhere in the same class too?
Yes. You could create and register one very much like you did for the child click listener.
精彩评论