0

In my program I set my layout orientation as vertical but if I am rotating my phone as horizontally than the screen is not appearing properly because the size of horizontal screen is less as compare to vertical so on keeping it on landscape mode the bottom part is not showing ,so how to fix all these problems??

Please tell me that i want that on keeping it horizontal the screen will appear like as on vertical in the center of screen,please help me??

Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167
ravi
  • 177
  • 2
  • 2
  • 11

3 Answers3

0

a very common and easy solution is to make a new layout-land folder under /res then copy your original xml onto this new folder and make your adjustements in both XML like android:orientation="horizontal" and android:orientation="vertical"

Riccardo Bocci
  • 213
  • 2
  • 10
0

You can modify the manifest file (AndroidManifest.xml) and force the activity to have ONLY portrait mode, like so:

Please refer to the below thread: Android - disable landscape mode?

Community
  • 1
  • 1
Gopal Nair
  • 830
  • 4
  • 7
0

If you don't want to block orientation then try it:

You can use separate xml for portrait and landscape mode.

  1. you have to create separate folders layout-land, layout-port

  2. save the layout xml in it.

  3. Both layout xml should have the same name.

Note: Keep the component id's same in both xml. just make arrangements

If you want to block orientation:

In your manifest

<activity android:name="YOUR_ACTIVITY"
          android:screenOrientation="portrait" />
Mahendran
  • 2,719
  • 5
  • 28
  • 50