Manjunath C R
Manjunath C R

Reputation: 1

How to create a slidein menu which slides from right to left in which slidein menu covers other part of screen?

I have to create a slidein menu from left to right and also the menu needs to slide on click of a button and not on swipe.

The menu should also cover the other part of the screen and should not slide the other part of the screen.

Upvotes: 0

Views: 985

Answers (2)

null pointer
null pointer

Reputation: 5914

use this https://github.com/jfeinstein10/SlidingMenu sliding menu libray.

to cover the other part use navigation drawer

or sliding layer

Upvotes: 2

FrancescoAzzola
FrancescoAzzola

Reputation: 2654

Have you tried the new pattern called Navigation Drawer?

Or you can create a RelativeLayout and put its visibility to GONE on the onCreate method of the Action. Then override the method onTouch like:

@Override
 public boolean onTouchEvent(MotionEvent event) {
   switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN : {
        startY = event.getY();
        break ;           
    }
    case MotionEvent.ACTION_UP: {
        float endY = event.getY();

        if (endY < startY) {
            System.out.println("Move UP");
            ll.setVisibility(View.VISIBLE);

        }
        else {
            ll.setVisibility(View.GONE);
        }
    }

}
return true;
}

If you want to add some animation:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:fromYDelta="100%"
            android:toYDelta="40%"
            android:duration="400"/>

</set>

and start the animation in the onTouch method. I've a post in my blog where you can find more information. Look here

Upvotes: 0

Related Questions