Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Vertical layout only

Tags:

android

How do I make sure my app is only for vertical layout?

I have tried android:screenOrientation="portrait" but that doesn't seem to do the trick.

like image 640
teepusink Avatar asked Mar 23 '10 22:03

teepusink


People also ask

How do you change linear layout to vertical?

To create a linear layout in which each child uses the same amount of space on the screen, set the android:layout_height of each view to "0dp" (for a vertical layout) or the android:layout_width of each view to "0dp" (for a horizontal layout). Then set the android:layout_weight of each view to "1" .

How do I fix portrait mode on my android?

To do this, swipe down from the right side of the top panel. Hold the device in the orientation in which you want it locked. On the drop-down menu, touch the “Auto Rotate” button. The “Auto Rotate” button becomes the “Rotation Locked” button.

What is linear layout in android?

Android LinearLayout is a view group that aligns all children in either vertically or horizontally.


1 Answers

You need to add to all your activity not for one only. I think you understood that setting is per application wide, but it isn't.

<activity android:name=".MyActivity"           android:label="My Activity"           android:screenOrientation="portrait"> 

Add the declaration to the activity tag in AndroidManifest for every Activity you want to be portrait-only.

like image 193
Pentium10 Avatar answered Sep 23 '22 06:09

Pentium10