Wednesday, July 31, 2013

Show Activity in Portrait or Landscape mode only

In Android, some times  we need to show an Activity/Screen in portrait or Landscape mode only. Specially while developing game, we want a particular game to be played in Landscape or Portfrait mode only.

for this we need to set the  android:screenOrientation  attribute in manifest

To show the Screen/Activity in Landscape mode only

 <activity android:name=".MainActivity"
           android:screenOrientation="landscape"/>


To show the Screen/Activity in Portrait mode only.

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

5 comments:

  1. thnak you.. Exactly what was I want.

    ReplyDelete
  2. Dear, I like your blog very much, I can get many useful information. Hope that we can communicate with each other. By the way, have you ever used resize server 2003 boot partition ? Unfortunately I lost my partition. I do not know how to do.

    ReplyDelete