Android:关于onSingleTapUp和onDoubleTap的问题

时间:2012-09-21 05:25:53

标签: android

单击onSingleTapUp函数正确执行,而在双击时,onSingleTapUp和onDoubleTap都会执行。

mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
            @Override
            public void onLongPress(MotionEvent e) 
            {

            }


            @Override
            public boolean onDoubleTap(MotionEvent e) 
            {
                cameracontrolslayout.setVisibility(RelativeLayout.GONE);
                presetcontrolslayout.setVisibility(RelativeLayout.GONE);

                ViewFLipperButtonsLayout.setVisibility(RelativeLayout.VISIBLE);
                    ptzcontrolslayout.setVisibility(RelativeLayout.VISIBLE);
                return true;
            }

            @Override
            public boolean onSingleTapUp(MotionEvent arg0) 
            {
                // TODO Auto-generated method stub

                cameracontrolslayout.setVisibility(RelativeLayout.VISIBLE);
                presetcontrolslayout.setVisibility(RelativeLayout.VISIBLE);


            return false;
            }

            @Override
            public boolean onDown(MotionEvent e) 
            {
                return true;
            }

       });

任何人都可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:4)

而不是onSingleTapUp为什么不使用onSingleTapConfirmed,但是在贴文时你的布局会显而易见。