0

I recently have published my app on the android market and am very. I have no errors and the app works fine. The only problem I have right now is that when the user tilts the screen to go into landscape view the interface is basically mutilated. My components are only on the left side of the screen (in landscape) and only half of them are showing. The normal vertical view is fine.

Is there a simple way to block the use of landscape or is there a way to make landscape easier to view?

Thank you!

Dan
  • 61
  • 2
  • 4

3 Answers3

3

In AndroidManifest.xml, for an activity, you can set its orientation attribute:

android:screenOrientation="portrait"
a_schimpf
  • 745
  • 1
  • 5
  • 16
2

You can either block it in the manifest

<activity android:name=".SomeActivity" android:screenOrientation="portrait"/>

Or you can make a new folder named layout-landscape, then put a layout of the same name in there and lay it out specifically for landscape. Just be careful of losing state upon rotation.

adonal3
  • 268
  • 2
  • 8
2

Instead of blocking landscape mode you can design additional layout xml resource for your activity in layout-land folder.

See http://developer.android.com/training/basics/supporting-devices/screens.html for details.

JustAnotherCoder
  • 621
  • 7
  • 13
  • 1
    IMHO the most reasonable answer. Apart from games I rarely see any good reason for blocking any device orientations. – Wolfram Rittmeyer Jun 08 '13 at 17:34
  • Agreed, mostly. It might be useful sometimes when your landscape views are just not up to snuff yet. Blocking landscape is a decent band aid solution while you fix the actual problem. – chandsie Jul 11 '13 at 21:47