简体   繁体   English

更改方向时,Android应用会关闭

[英]Android app closes when the orientation is changed

I want my app to run in the portrait view so I made the following changes in the android manifest file. 我希望我的应用程序在纵向视图中运行,所以我在android清单文件中进行了以下更改。

android:screenOrientation="portrait"

It stays in the portrait view for a second and then it closes.. I had assumed this is the only change i had to make..but i also added this but it isnt working 它停留在纵向视图中一秒钟然后它关闭..我原以为这是我必须做的唯一改变..但我也添加了这个但它不起作用

 android:configChanges="orientation"

Am i missing something? 我错过了什么吗?

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

Try this adding android:configChanges to your AndroidManifest file in the activity tag 试试这个将android:configChanges添加到activity tag中的AndroidManifest文件中

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

Hope this works for you. 希望这对你有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更改为横向时,Android应用程序崩溃 - Android app crashes when changed to landscape orientation 更改屏幕方向后,Android应用终止 - Android app terminates when screen orientation is changed 更改方向时,带有横幅广告的 Android 应用程序被压碎 - Android app with banner ad is crushed when the orientation is changed Android:无法实现屏幕方向,应用在设备旋转时关闭 - Android: Unable to achieve screen orientation, app closes on device rotation 当进度对话框正在进行且应用程序的方向发生更改时,Android应用程序崩溃。 为什么? - Android app crash when progress dialog is on progress and app's orientation changed. why? Android:方向改变时的后退动画 - Android: backbutton animation when orientation is changed 方向更改时Android中的ViewPagerIndicator问题 - Issue with ViewPagerIndicator in Android when orientation is changed 更改方向后重新加载Titanium Android - Titanium android reloading when orientation was changed 更改方向时可以看到/不看到Android Image - Android Image is seen/not seen when orientation is changed android - 如何在方向改变时完成活动? - android - how to finish an activity when the orientation is changed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM