簡體   English   中英

更改方向時,Android應用會關閉

[英]Android app closes when the orientation is changed

我希望我的應用程序在縱向視圖中運行,所以我在android清單文件中進行了以下更改。

android:screenOrientation="portrait"

它停留在縱向視圖中一秒鍾然后它關閉..我原以為這是我必須做的唯一改變..但我也添加了這個但它不起作用

 android:configChanges="orientation"

我錯過了什么嗎?

     <activity android:name=".Menu" android:label="COMEDY TRIVIA"
        android:screenOrientation="portrait" android:configChanges="orientation"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
        <intent-filter>
            <action android:name="nik.trivia.MENU" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

試試這個將android:configChanges添加到activity tag中的AndroidManifest文件中

<activity android:name=".Fourth" android:label="Fourth" android:configChanges="orientation|keyboardHidden"></activity>

希望這對你有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM