Issue
I have an ImageView
overlay inside of a RelativeLayout
and want to prevent any clicks from going through the ImageView
to the Buttons etc that are behind it (thus in effect disabling the entire RelativeLayout
).
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);
view.setEnabled(true);
}
Solution
Simply call rlTest.setClickable(false)
. This will prevent the click to be propagate to the children
Answered By - Blackbelt
Answer Checked By - Pedro (JavaFixing Volunteer)