问题
I've set intent filter label as per and per and per official docs:
The icon and label that are set in a component's are shown to the user whenever that component is presented as an option to fulfill an intent. By default, this icon is inherited from whichever icon is declared for the parent component (either the or element), but you might want to change the icon for an intent filter if it provides a unique action that you'd like to better indicate in the chooser dialog. For more information, see Allow Other Apps to Start Your Activity.
So my app's manifest looks like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
<application
android:label="@string/app_name">
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main">
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Setting intent filter's label does NOT set @string/app_name
in launcher in my case. The string @string/title_activity_main
is used instead.
I think it may be related to my setting compileSdkVersion 29
because when I run my app on emulator with Android 5.1 the same problem occurs.
Further more when I'm uninstalling the app then a new popup layout is shown - with string:
[content of @string/title_activity_main] is part of the following app [content of @string/app_name]. Do you want to uninstall this app?
来源:https://stackoverflow.com/questions/61328477/app-name-in-launcher-is-taken-from-main-activity-label-insead-of-from-intent-lab