安卓:“闪屏”只有一次 [英] Android: 'Splash screen' only once

查看:235
本文介绍了安卓:“闪屏”只有一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,需要一个启动画面。我有一个简单的活动,显示启动画面和一些秒后,它会启动'主'的活动。现在,当用户presses从该活动的后退按钮,启动画面再次出现。我怎样才能prevent呢?我试图保持一个布尔shownSplash,这部分工作,但应用程序运行时,用户希望从应用程序 - 启动器打开它,应用程序退出(因为飞溅调用完成()时splashShown为true)。任何想法?

I have a Android application that requires a splash screen. I have a simple activity which shows the splash screen and after a number of seconds, it starts the 'main' activity. Now, when a user presses the back button from that activity, the splash screen shows again. How can I prevent this? I tried keeping a boolean shownSplash and this partially works, but when the app is running and the user wants to open it from the app-launcher, the app exits (since splash calls finish() when splashShown is true). Any ideas?

谢谢, 埃里克

推荐答案

设置安卓noHistory =真正的来在AndroidManifest.xml中的活动条目。这将prevent活动被保存在堆栈中。

Set android:noHistory="true" to the activity entry at the AndroidManifest.xml. That will prevent the activity from being saved on the stack.

这篇关于安卓:“闪屏”只有一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆