How to disable all user inputs (click, touch) on an android view -


I have a game view that is an extension of the view class. In this view I use canvas drawing objects, which can interact with users.

This view is loaded in the layout of an activity. Tried to use gameView.setEnabled (false);

I am trying to disable all user input in game view. GameView.setClickable (wrong);

But still the user can interact with canvas objects.

FYI: Also applies the following as the Gwavez class interface.

  public class gameview experience on on guestloster, onltap listener, openlashstream listener, animation listener  

Apply to your gameviewTeuveEvent () this way.

  Public Category GameView View Expands {Public Boolean isTouchable () {Return isouchable; } Public ZeroSetchable (boolean hatchable) {this.isTouchable = isTouchable; } Private boolean isouchouch = true; Public Gameview (context references, AttributeSet ethers) {Super (theme, ethers); } Public Game View (Reference Reference) {Super (Reference); } //// ... Your code @ Override Public Boolean on Touch Event (Motion Event Event) {If (Itachualable) {Return Super. ToechEvent (event); }         return false; }}  

How to use?

  gameView.setTouchable (wrong); // GameView.setTouchable to disable touch (true); //  
to enable touch

Comments