Reputation: 763
I want to make my android activity unclickable. I have tried Enable/disable an activity programatically but it's not working for me.
I also tried to get relative layout disable but it is not working.
Is there any other ways for making and android activity(full) unclickable?
Upvotes: 1
Views: 5882
Reputation: 3409
You can create a fake transparent view which takes up with whole screen and place it on top of all views.
private boolean shouldBlockTouches = false;
fakeView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return shouldBlockTouches;
}
});
set the shouldBlockTouches where ever you please.
Upvotes: 3
Reputation: 2336
I think u can try by applying onClick on root layout and do nothing.tou can do this as well if u want activity unclickable then doesn't provide any beahvior will tend to do nothing.
Upvotes: 0
Reputation: 178
You could set every view as unclickable in the XML:
android:clickable="false"
Upvotes: 2