Gesture Swipe in Android

I am working on a app where in i have a basic activity,When i swipe from left to right i need i need to get a swipe window which will display few icons,when i click from right to left i need to get an swipe window from right to left...i researched a bit...nd found few options like navigation drawer and swipe window and view pager....but swipe gesture jst swipes continuously from one page to another...i dont want that...i need to display few icons when i swipe from left to right and right to left....but i don't know exactly which one to use for better navigation.... i used the following code:

@Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { String swipe = ""; float sensitvity = 50;

        // TODO Auto-generated method stub

        if((e1.getX() - e2.getX()) > sensitvity){
            swipe += "Swipe Leftn";
            SwipeLeft();
        }else if((e2.getX() - e1.getX()) > sensitvity){
            swipe += "Swipe Rightn";
        }else{
            swipe += "n";
        }

        if((e1.getY() - e2.getY()) > sensitvity){
            swipe += "Swipe Upn";
        }else if((e2.getY() - e1.getY()) > sensitvity){
            swipe += "Swipe Downn";
        }else{
            swipe += "n";
        }

        gestureEvent.setText(swipe);

        return super.onFling(e1, e2, velocityX, velocityY);
    }
};

I am confused on wthr i should use swipe of view pager.. this is something what i want.. 在这里输入图像描述 Help appreciated. Thanks.


如果你想从屏幕两侧尝试像导航抽屉这样的东西,即从右到左交换和从左到右的下面的链接将帮助你

链接地址: http://www.djcxy.com/p/91200.html

上一篇: 停止Android Studio中的动画

下一篇: Android中的手势滑动