开发者

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:

  1. Have the one child click listener do many things.

  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜