user924941
user924941

Reputation: 1011

move the screen content to the left outside the screen android

is there a way to move the whole screen content outside the screen bounds, with titlebar and all, on the left for example, i tried

content = ((LinearLayout) act.findViewById(android.R.id.content)
                .getParent());

to get the screen content and add a margin to it

FrameLayout.LayoutParams pr = (android.widget.FrameLayout.LayoutParams) content
                    .getLayoutParams();
            pr.rightMargin = xOffset;
            content.setLayoutParams(pr);

but it doesnt work, the margin appears but the content is not moved just resized to fit the screen, anyone know how to do this the simple way?

Upvotes: 1

Views: 1163

Answers (2)

skygeek
skygeek

Reputation: 1568

you can set the margin in negative(-) values. for example if your want the layout to move upper use this:

android:marginTop = "-50dip or more u can put"

Upvotes: 1

Joss Stuart
Joss Stuart

Reputation: 1886

Are you trying to flip between views? As in, moving that layout off the screen to show another one? If so you should look at using a widget called ViewFlipper which will do exactly as you need. It can also be animated etc.

http://developer.android.com/reference/android/widget/ViewFlipper.html

Upvotes: 0

Related Questions