Mandate Android Application to Start Portrait Only, BUT ability to rotate when running
I have an application that 开发者_JS百科I want to start only in portrait, but once it has begun allow for configuration change. The content of the landscape mode is a map image that relates to the information on the portrait view.
you could start you activity in portrait mode using
<activity
android:name=".ui.FrmSignature"
android:label="@string/frmsignature_lblTitle"
android:screenOrientation="portrait"
/>
and then, inside your code, you can link the orientation change to device position setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR).
You can do it by using android:screenOrientation="portrait"
in your Manifest file.
Just add android:screenOrientation="portrait
to your activity Tag in which you'd like to show Portrait..
<activity android:name=".Keydets_Main" android:label="@string/app_name" android:icon="@drawable/keydets_icon" android:screenOrientation="portrait" />
If you add this for Particular Activity , only that activity will comes in Portrait Mode.
If you Specify inside of Application Tag it will applicable for whole app.
精彩评论