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 screen and slides that image towards right so as to show menu on left hand side and slide image with some transition. But in that case, the layout on the right is not clickable since its an image.
But I have some another way of doing it in which I have a Root Layout which already has Menu Layout and Content Layout. But root layout is set some negative margin towards left so it is not visible. Like this-
When user presses menu button, the Menu Layout is slid to the right and root layout's left margin is set to 0. So now what we see is this-
Now, The real problem starts here
I want to slide both the layouts with some animation. So when I animate the Menu layout & Content Layout, the animation for both the layouts is not at same speed even if I am applying same animation to it. So I tried to Shift ROOT LAYOUT only towards right/left by setting margin to it. But on doing so nothing is shown on the screen. Where am I going wrong. The way I set margin is shown here-
int width = leftLayout.getWidth();
isLayoutShown = !isLayoutShown;
if(isLayoutShown){
rootLayoutParams.setMargins(0, 0, 0, 0);
rootLayout.setLayoutParams(rootLayoutParams);
}else{
rootLayoutParams.setMargins(-width, 0, 0, 0);
rootLayout.setLayoutParams(rootLayoutParams);
}