cant move screen content on devices lower then 3.0 android

I need to move the screen content on the left so i use this code to get the content

try {
        content = ((LinearLayout) act.findViewById(
    } catch (ClassCastException e) {
         * When there is no title bar
         * (android:theme="@android:style/Theme.NoTitleBar"), the
         * FrameLayout is directly attached to the
         * DecorView, without the intermediate LinearLayout that holds the
         * titlebar plus content.
        content = (FrameLayout) act.findViewById(;

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
            pr.rightMargin = menuSize;
            pr.leftMargin = -menuSize;

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.

Need Your Help

Building LINQ Expressions Dynamically w/ Unknown Types

c# linq expression-trees

I am wondering if it is possible to use this expression builder class to generate lambda expressions dynamically where the type to be filtered is not known at compile time.

Reading bluetooth data and sending obtained message to UI (Android & C#)

c# android bluetooth

My app must get data from a bluetooth barcode reader. The string data should be sent directly to the virtual keyboard input (or EditText field).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.