<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sowsceo.rnadomsows"> <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".produce.ActivityRandom" />
</application>
</manifest>
强制每个activity的横屏或纵屏,也就是说,当用户设置手机可以“自动旋转”时,对于已经强制横屏或纵屏的界面无效,
问题:如何让activiy的界面强制呢!
解答:
在AndroidManifest.xml文件中,对<activity></activity>进行设置
<activity android:name=".produce.ActivityRandom"
android:launchMode="singleTask"
android:screenOrientation="landscape"/> launchMode/screenOrientation 两种参数的设置,缺一不可 android:launchMode="singleTask"
参数说明,详细点击它 http://2960629.blog.51cto.com/2950629/701227 android:screenOrientation="landscape"
landscape是横向,portrait是纵向