tags:

views:

55

answers:

2

I have a ViewGroup (LinearLayout) which contains a couple of TextViews and one ImageView. I want to make this entire group clickable.

I tried something like this:

    viewGroup.setOnClickListener( new OnClickListener(){
        @Override
        public void onClick() {
            //do stuff
        }
    });

However, clicks on the TextViews or ImageViews or on the area enclosed by the ViewGroup above doesn't result in the handler being called.

Any suggestions on how I can make a whole ViewGroup clickable?

A: 

Make the layout click-able. You can make the layout clickable (you might have to use the focus attributes). Just don't forget to assign an ID to the layout so you can detect it.

mobibob
A: 

Solution was as simple as adding

android:clickable="true"

to the xml for the RelativeLayout group

psychotik