I want to have facebook like menu in my application. There are many threads on this and all of them suggest to use a library which actually just takes a screenshot of the sc
Finally somehow I could do it. Here's the code used when I click on the menu button on the left top corner:
@Override
public void onClick(View v) {
rootLayoutParams = new LayoutParams(rightLayout.getWidth(),
rightLayout.getHeight());
if (lhsMenu.getVisibility() == View.GONE) {
lhsMenu.setVisibility(View.VISIBLE);
Animation slideRight = setRightSlidingAnimation();
rightLayout.setAnimation(slideRight);
lhsMenu.setAnimation(slideRight);
} else {
Animation slideLeft = setLeftSlidingAnimation();
rightLayout.setAnimation(slideLeft);
lhsMenu.setAnimation(slideLeft);
lhsMenu.setVisibility(View.GONE);
}
}
Update: Also set margin to left and right (if needed) of rightLayout
so that the rightLayout will not shrink.
_rightLayoutParams.setMargins(width, 0, -width, 0);
where width = 200
in my case.