0
votes

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 Left\n";
            SwipeLeft();
        }else if((e2.getX() - e1.getX()) > sensitvity){
            swipe += "Swipe Right\n";
        }else{
            swipe += "\n";
        }

        if((e1.getY() - e2.getY()) > sensitvity){
            swipe += "Swipe Up\n";
        }else if((e2.getY() - e1.getY()) > sensitvity){
            swipe += "Swipe Down\n";
        }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..enter image description here Help appreciated. Thanks.

1

1 Answers

1
votes

If you wanted try something like navigation drawer from both side of screen i.e. Right to left swap and Left to right following link will help you