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