Android : Change App Label programmatically

后端 未结 8 1860
轻奢々
轻奢々 2020-11-28 11:27

How can I change application label to change app name shown from java code in android? I\'m refering to:



        
相关标签:
8条回答
  • 2020-11-28 11:32

    in the activity, i tried

    this.setTitle("your text");
    

    and it worked. I hope it's a common solution

    0 讨论(0)
  • 2020-11-28 11:33

    In Launcher Activity,Before setContentView() write this,

    setTitle("Your Title");
    

    I don't know how it's possible, But it's surely works.

    0 讨论(0)
  • 2020-11-28 11:43

    Application's android:label is a fixed resource referrer.

    But the string under this referrer could have multiple values, depending on configuration qualifier names (values-en, -large, -land, etc.), according to Providing Alternative Resources.

    0 讨论(0)
  • 2020-11-28 11:50

    To anyone interested: Android How to change the application title But it's not clear if it changes the "application label" (that is, the name of the icon in the application list) or only the window title.

    0 讨论(0)
  • 2020-11-28 11:52

    As Mister Smith said, it is not possible,

    but you could use multiple ActivityAlias, which can be enabled/disabled dynamically and point to the same targetActivity. Therefore create your chooser for the app name - let the user select one and enable the ActivityAlias via the packageManager:

    ComponentName componentName = new ComponentName(context, context.getPackageName() + "." + aliasName);
            context.getPackageManager().setComponentEnabledSetting(componentName,
                                                                   PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
                                                                   PackageManager.DONT_KILL_APP);
    

    To hide the old alias, use the same code with the flag : COMPONENT_ENABLED_STATE_DISABLED

    You can also add the possibility to directly add a shortcut to the home launcher, after you enabled the alias. There are plenty ways described here on sow.

    0 讨论(0)
  • 2020-11-28 11:57

    It's not possible by the moment. It is a fixed string in the AndroidManifest.xml file which cannot be changed at runtime.

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