我有一个这样的滚动视图的相对布局:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="576dp"
android:background="@drawable/text_main"
>
我想停止方向更改并使其垂直固定。我怎样才能做到这一点?
我有一个这样的滚动视图的相对布局:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="576dp"
android:background="@drawable/text_main"
>
我想停止方向更改并使其垂直固定。我怎样才能做到这一点?
将此添加到AndroidManifest.xml的MainActivity中:
<activity
...
android:screenOrientation="landscape"
... >
</activity>
There are two ways of doing this
Static
<activity
android:name="com.photon.filnobep.activities.ActivitySettings"
android:icon="@drawable/icon_small"
android:label="@string/title_activity_activity_settings"
android:logo="@drawable/icon_small"
android:screenOrientation="landscape"
android:theme="@style/MyTheme" >
</activity>
Pro-grammatically(In your java class)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Note: using Static method you still can change Orientation from you java Class
根据你的
<activity>
您可以在清单中添加标签
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation" >