首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android Home Launcher,在Launcher中添加带有图标的活动

Android Home Launcher,在Launcher中添加带有图标的活动
EN

Stack Overflow用户
提问于 2015-12-11 19:39:32
回答 2查看 1.3K关注 0票数 0

我已经创建了一个自定义启动器和它的完美工作的fine.Now,我想添加一个活动,这将像任何其他应用程序从启动器启动。

这是我的清单文件。

代码语言:javascript
复制
 <activity
        android:name="com.sample.launcher2.Launcher"
        android:launchMode="singleTask"
        android:clearTaskOnLaunch="true"
        android:stateNotNeeded="true"
        android:resumeWhilePausing="true"
        android:theme="@style/Theme"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="nosensor">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.MONKEY"/>
        </intent-filter>
    </activity>

    <activity 
        android:name="com.sample.launcher2.MainActivity"
        android:label="@string/application_name"
    android:icon="@mipmap/ic_launcher_home">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

我无法从launcher.How启动活动,我可以实现它吗?

EN

回答 2

Stack Overflow用户

发布于 2015-12-11 20:06:42

代码语言:javascript
复制
Make following changes hope it will work
<activity
        android:name="com.sample.launcher2.Launcher"
        android:launchMode="singleTask"
        android:clearTaskOnLaunch="true"
        android:stateNotNeeded="true"
        android:resumeWhilePausing="true"
        android:theme="@style/Theme"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="nosensor">
        <intent-filter>
            <action android:name="com.sample.launcher2.Launcher" />//Here the change
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.MONKEY"/>
        </intent-filter>
    </activity>

    <activity 
        android:name="com.sample.launcher2.MainActivity"
        android:label="@string/application_name"
        android:icon="@mipmap/ic_launcher_home">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
           <category android:name="android.intent.category.DEFAULT" />
           <category android:name="android.intent.category.HOME"/>
        </intent-filter>
    </activity>
票数 1
EN

Stack Overflow用户

发布于 2017-01-05 16:50:13

将该活动的启动模式更改为singleTask可能会有所帮助!

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

https://stackoverflow.com/questions/34222725

复制
相关文章

相似问题

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