Google Glass - 禁用向下滑动手势

时间:2014-07-12 15:55:33

标签: android google-glass gesture

我想禁用使用向下滑动手势完成当前活动的选项。我想我们可以在createGestureDetector方法中做到这一点,但是怎么做?

if (gesture == Gesture.SWIPE_DOWN) {
                // TODO disable this gesture
            }

1 个答案:

答案 0 :(得分:0)

import com.google.android.glass.touchpad.Gesture;
import com.google.android.glass.touchpad.GestureDetector;

public class MainActivity extends Activity 
    implements GestureDetector.BaseListener, GestureDetector.FingerListener{

    private GestureDetector mGestureDetector;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mGestureDetector = new GestureDetector(this).setBaseListener(this).setFingerListener(this);
    }

    @Override
    public boolean onGesture(Gesture gesture) {
        if(gesture == Gesture.SWIPE_DOWN){
            return false;
        }
    }
    return true;
}