首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么我的android启动器在Home Press上重新打开

为什么我的android启动器在Home Press上重新打开
EN

Stack Overflow用户
提问于 2016-08-13 02:00:22
回答 1查看 95关注 0票数 0

我正在开发一个启动器应用程序。当我在启动器上,并按下home键时,该活动将以动画形式显示,并打开该活动的一个新实例。如何才能在按下主页时仅停留在主屏幕活动上?

代码语言:javascript
复制
<application
        android:name=".BaseApplication"
        android:allowBackup="true"
        android:launchMode="singleTask"
        android:clearTaskOnLaunch="true"
        android:stateNotNeeded="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">


        <activity android:name=".MainActivity"
                  android:launchMode="singleInstance"
                  android:excludeFromRecents="true"
                  android:windowSoftInputMode="adjustPan"
            android:screenOrientation="sensorPortrait"
            android:configChanges="orientation|keyboardHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.HOME"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        ...
EN

回答 1

Stack Overflow用户

发布于 2016-08-13 04:45:54

将活动的launchMode设置为"singleTask“或"singleTop”解决了此问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38923954

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档