简体   繁体   English

Android清单,如何禁用较低API的启动器图标

[英]Android Manifest, how to disable launcher icon for lower api

i have an accessibility application ive written, but on android 4.0 and higher, the api allows for a settings activity to be set. 我已经编写了一个可访问性应用程序ive,但是在android 4.0及更高版本上,该api允许设置设置活动。 This defeats the purpose of having a launcher entry. 这违反了具有启动器入口的目的。 Is there a way to single out 4.0 and higher systems in the manifest to not have the launcher icon? 有没有一种方法可以使清单中的4.0及更高版本的系统没有启动器图标?

EDIT: solution 编辑:解决方案

I subclassed the original settings to a JB/ICS one. 我将原始设置细分为JB / ICS。 this is pretty uncessesary at this point, but if something JB/ICS specific is added to the app, it would probably be good in the long run to keep them seperate. 在这一点上,这是完全不必要的,但是,如果将特定于JB / ICS的内容添加到应用程序中,从长远来看,保持它们分开可能会很好。

thanks alanv, your snippet did still help 谢谢alanv,您的代码段确实对您有所帮助

You can selectively disable an activity based on the platform version. 您可以根据平台版本有选择地禁用活动。 Add an activity alias for your Settings activity and set the enabled attribute to a platform-specific value. 为您的“设置”活动添加活动别名,并将enabled属性设置为特定于平台的值。 This will ensure that it only shows up in the Launcher when you need it to. 这将确保它仅在需要时显示在启动器中。

AndroidManifest.xml: AndroidManifest.xml中:

<activity
    android:name=".MySettingsActivity"
    . . . >
</activity>

<activity-alias
    android:name=".MyActivityAlias"
    android:label="@string/settings"
    android:targetActivity=".MySettingsActivity"
    android:enabled="@bool/show_settings">
        <intent-filter>
        . . .
        </intent-filter>
</activity-alias>

values-v14/bool.xml: 值-V14 / bool.xml:

<bool name="show_settings">false</bool>

values/bool.xml: 值/ bool.xml:

<bool name="show_settings">true</bool>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM