2014-01-30 58 views
12

不知道是否有其他人发布了此问题,没有找到任何人,尽管也有类似的问题。从应用程序标签中挑选的Android应用图标名称

这是我的清单XML:

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.listCalc.tutorial.simpleinappbillingv3.ui.StartUpActivity" 
     android:label="@string/activity_startup_label" 
     android:screenOrientation="portrait" > 
     <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 

     <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.listCalc.tutorial.simpleinappbillingv3.ui.MainActivity" 
     android:label="@string/activity_main_label" 
     android:screenOrientation="portrait" /> 
    <activity 
     android:name="com.listCalc.tutorial.simpleinappbillingv3.ui.PurchasePassportActivity" 
     android:label="@string/activity_purchase_label" 
     android:screenOrientation="portrait" /> 
    </application> 

String.xml:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 

    <string name="app_name">List Calc in-app billing V3</string> 
    <string name="hello_world">Hello world!</string> 
    <string name="menu_settings">Settings</string> 
    <string name="main_button_purchase_passport_text">Purchase Passport</string> 
    <string name="main_cont_desc_image_passport">purchased passport</string> 
    <string name="activity_startup_label">Loading</string> 
    <string name="activity_main_label">Main Menu</string> 
    <string name="activity_purchase_label">Making Purchase</string> 

</resources> 

应用程序的名称,即启动器图标名被挑选为 “activity_startup_label”,而不是 “APP_NAME”

我在做什么错了?

+0

请在这里发表您string.xml数据也为更好地理解 – Noundla

回答

11

我在做什么错?

什么都没有。这是按照设计工作的。

欢迎您也对<intent-filter>,它应该用于启动器图标标签的android:label属性,根据the documentation

一个意图过滤器的图标和标签集用来表示无论何时将组件呈现给用户以履行过滤器通告的功能。例如,带有“android.intent.action.MAIN”和“android.intent.category.LAUNCHER”设置的过滤器会将一个活动作为启动应用程序的活动进行通告 - 即,应该在应用程序启动器中显示的活动。过滤器中设置的图标和标签因此是在启动器中显示的图标和标签。

+3

我不知道提供的截图,但在我的情况是它仍然从''获得'android:label'作为启动器图标标签,并使用第e''就在我卸载应用时。 – AlvaroSantisteban

+0

谢谢@CommonsWare,你是Android社区的救星。 – Tarun

+0

那么如果活动在其根目录和目标过滤器中都有标签,那么'application'中的点设置标签是什么?我假设如果我在'application'中有标签,我不会在意图过滤器中使用'label' ... – deadfish

0

大概是因为主要活动的标签是“activity_startup_label”

0

在你的manifest.xml更改标签:

android:label="@string/app_name" 
1

如果你有一个“启动活动”用[标签名称] &“应用程序标签”也有不同的[标签名称],那么Android会从启动程序活动中获取[标签名称]。

1

Commonsware提出的另一种解决方案(我发现它在某些设备上碰到并错过)是设置应用程序在标签清单中的名称,如而不是 set在清单中,取而代之的是发射活动的标签以编程方式设置在你活动的onCreate(Bundle)方法如下:

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setTitle(R.string.activity_startup_label); 
    // do whatever else you need to 
} 
相关问题