Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable touch event android

Tags:

android

touch

How to disable touch event android?

like image 225
kanivel Avatar asked Mar 23 '11 09:03

kanivel


3 Answers

Do nothing but just return true in onTouchEvent().

If you are using any view, use android:clickable="false" as view's attribute in the xml.

like image 101
theWook Avatar answered Oct 05 '22 17:10

theWook


I solved like below,

 view.setClickable(true);
            view_activity.setOnTouchListener(new OnTouchListener() {

                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    if (view_activity.isClickable()) {
                        if (isOpened)
                            closeMenu();
                 return false;
                    }
                else
                    return true;                    
                }
            });
like image 38
Sreedhu Madhu Avatar answered Oct 05 '22 15:10

Sreedhu Madhu


if it's a View, you can use his method setClickable(false)

like image 26
primax79 Avatar answered Oct 05 '22 15:10

primax79