Android 禁止響應屏幕翻轉

app安裝到手機後,翻轉屏幕,頁面可能出現變型,彈出框消失等問題,禁止屏幕翻轉:android

要在androidmanifest.xml 中加入 android:screenOrientation="portrait"app

須要在application 標籤屬性加入,也須要在全部activity標籤屬性加入ui

<application
        android:allowBackup="true"
        android:icon="@drawable/ui"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" android:screenOrientation="portrait">
        <activity
            android:name="com.pccw.barcodescanner.MainActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.NoTitleBar" 
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.pccw.barcodescanner.ServiceConfigActivity"
            android:label="@string/main_config"
            android:theme="@android:style/Theme.NoTitleBar" android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.pccw.barcodescanner.OnlineActivity"
            android:label="@string/main_Rbonline"
            android:theme="@android:style/Theme.NoTitleBar" android:screenOrientation="portrait" >
        </activity>
相關文章
相關標籤/搜索