I’m looking for a way to lock the user interface, for example when I select “Lock” from the options menu, the UI will be block from touches. It’s sort of adding an overlay with some kind of lock icon over the UI.
Do you guys have any suggestions? Thanks!
I’m looking for a way to lock the user interface, for example when I
Share
Do you need to do that on multiple activities or just one ?
If it’s just one, then add a transparent ViewGroup(MatchParent,Parent) to the top of your view hierarchy. Make it Gone by default.
Then in OnCreate(), add a OnTouchListener that always returns true (meaning that it took into account the touch);
Then when you need it, just make it “Visible”.
Explanation : adding it to the top will make it the top-most “layer” in the view hierarchy. So it will be first to receive touch events which you then veto by returning true to the listener’s caller.