关闭我的Andr​​oid应用在我的背部pressed主要活动 [英] Closing my Android app in my main activity on back pressed

查看:114
本文介绍了关闭我的Andr​​oid应用在我的背部pressed主要活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个活动:

答:闪屏

A:主要活动

在应用程序启动时,我给闪屏与一个简短的视频,然后调用B.我希望用户能够在活动B.(后退按钮关闭应用程序的用户不应该再看到启动画面。 )

When the application starts, I show the splash screen with a short video then call B. I want the user to be able to close application with the back button in activity B. (The user shouldn't see splash screen again.)

推荐答案

您可以设置机器人:noHistory =真在清单中的闪屏。这将不会在活动添加到背叠

You can set android:noHistory="true" for the splash screen in the manifest. This will not add the activity to the back stack.

<activity
    android:name="SplashScreen"
    android:noHistory="true"
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

这篇关于关闭我的Andr​​oid应用在我的背部pressed主要活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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