gpt4 book ai didi

android - 按返回键后黑屏

转载 作者:行者123 更新时间:2023-11-29 02:26:59 25 4
gpt4 key购买 nike

我的应用只包含一个 Activity 和一个广告 Activity 。它运行良好,但是当我按下“后退”按钮时,我的应用程序关闭了,我可以看到,而不是墙纸,黑色背景部分向下滚动。我也可以看到所有图标。然后屏幕的黑色部分消失,我可以看到我的正常屏幕壁纸。它只需要不到一秒钟,但很烦人。我找不到问题所在。

我的 Activity 只有水平方向,并且在按下后退按钮后具有正确的生命周期(onPause-onStop-onDestroy)。广告 Activity 根本没有启动。

我没有覆盖 onPause() onStop() onDestroy()

我的 list

<application
android:allowBackup="true"
android:icon="@mipmap/icon_transp_bkg"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="MainActivity"
android:screenOrientation="sensorLandscape"
android:configChanges="orientation|screenSize"
android:theme="@style/PlayTheme2">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>

它会不会与返回堆栈和尝试搜索之前的一些 Activity 有关?

请告诉我解决问题的正确方法。非常感谢。

最佳答案

你可以使用 OnBackPressed

@Override
public void onBackPressed() {
// what you want to do when back button is pressed
}

关于android - 按返回键后黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51722492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com