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.
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" .
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.
Android LinearLayout is a view group that aligns all children in either vertically or horizontally.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With