Disable landscape mode for some of the views in my Android app


The screen orientation has changed — the user has rotated the device.

Note: If your application targets API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), then you should also declare the "screenSize"configuration, because it also changes when a device switches between portrait and landscape orientations.     More

You can just put on your activity on manifest file:

             <activity android:name=".MainActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait">


If you still need to force portrait for some reason, sensorPortrait may be better than portrait for Android 2.3+; this allows for upside-down portrait, which is quite common in tablet usage.

Go to this link may be h elpful: http://code.google.com/android/reference/android/R.styleable.html#AndroidManife‌​stActivity_screenOrientation

Happy Coding!!!

No comments:

Post a Comment

Circle

Most recent Elastic Search tutorials for beginner, intermediate and advance level developer, Yubraj Pokharel, in CodingWorkspace