繁体   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