Android app icon name picked from activity label than from application label

前端 未结 5 2064
旧巷少年郎
旧巷少年郎 2021-02-19 05:56

Not sure if anyone else posted this question, didn\'t find any, though there are similar ones.

This is my manifest xml:



        
相关标签:
5条回答
  • 2021-02-19 06:11

    What am I doing wrong?

    Nothing. This is working as designed.

    You are welcome to also have an android:label attribute on the <intent-filter>, which should be used for the launcher icon label, according to the documentation:

    The icon and label set for an intent filter are used to represent a component whenever the component is presented to the user as fulfilling the function advertised by the filter. For example, a filter with "android.intent.action.MAIN" and "android.intent.category.LAUNCHER" settings advertises an activity as one that initiates an application — that is, as one that should be displayed in the application launcher. The icon and label set in the filter are therefore the ones displayed in the launcher.

    0 讨论(0)
  • 2021-02-19 06:11

    An alternative solution to the one proposed by Commonsware (which I've found to be hit and miss on some devices) is to set the label of the application in the manifest as you're doing, to not set the label of the launcher activity in the manifest and instead to set it programmatically in your activity's onCreate(Bundle) method as follows:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle(R.string.activity_startup_label);
        // do whatever else you need to
    }
    
    0 讨论(0)
  • 2021-02-19 06:21

    In your manifest.xml change your label to:

        android:label="@string/app_name"
    
    0 讨论(0)
  • 2021-02-19 06:27

    Probably because the label of the main activity is "activity_startup_label"

    0 讨论(0)
  • 2021-02-19 06:30

    If you have a "launcher activity" with [label name] & "application tag" also with a different [label name] then Android will take the [label name] from the Launcher Activity.

    0 讨论(0)
提交回复
热议问题