I need to move the screen content on the left so i use this code
to get the content
try {
content = ((LinearLayout) act.findViewById(android.R.id.content)
.getParent());
} catch (ClassCastException e) {
/*
* When there is no title bar
* (android:theme="@android:style/Theme.NoTitleBar"), the
* android.R.id.content FrameLayout is directly attached to the
* DecorView, without the intermediate LinearLayout that holds the
* titlebar plus content.
*/
content = (FrameLayout) act.findViewById(android.R.id.content);
}
I noticed that on devices with android > 3.0 the content sets in the try block, on devices < 3.0 it goes in the catch block.
Here I move the content:
FrameLayout.LayoutParams pr = (android.widget.FrameLayout.LayoutParams) content
.getLayoutParams();
pr.rightMargin = menuSize;
pr.leftMargin = -menuSize;
content.setLayoutParams(pr);
So on devices >3.0 all works great the content si moved, on devices <3.0 nothing happenes the content just sits with no changes
Found the answer FrameLayout wont take into consideration the margins if gravity is not set.