Apqu Apqu - 1 year ago 142
Java Question

Prevent Click-through of Android ImageVIew?

I have an

overlay inside of a
and want to prevent any clicks from going through the
to the Buttons etc that are behind it (thus in effect disabling the entire

Is the a simpler way of doing this then iterating the RelativeLayout views and setting them to disabled as I currently am doing using this code:

RelativeLayout rlTest = (RelativeLayout ) findViewById(R.id.rlTest);
for (int i = 0; i < rlTest.getChildCount(); i++) {
View view = rlTest.getChildAt(i);

Answer Source

Simply call rlTest.setClickable(false). This will prevent the click to be propagate to the children

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download