开发者

Android: How to customize the label under the launcher icon

The name of my Android app is 14 characters long with no spaces, as such, the full name is not visible on the home screen when displayed under the launcher icon.

I want to use an alternate name for displaying under the 开发者_JAVA技巧launcher icon, so I can break up the name into two strings separated by a space - so that the words should wrap.  

How can this be done?


Modify your res\values\strings.xml to have two strings:

  1. app_name_wrappable = "App Name"
  2. app_name = "AppName"

Then modify your AndroidManifest.xml (or anywhere else you want the wrapping behavior) to read:

<application 
    android:icon="@drawable/icon" 
    android:label="@string/app_name_wrappable">

And leave everything else the same as it is currently.


If you want to see the name of your app below the app icon, you should change the android:label of the starting activity as the required app name.

Should use String.xml for that:

 <string name="app_name">YourAppName</string>//Add this code in Strings.xml file

Change AndroidManifest.xml as below:

 <application
        android:allowBackup="true"
        android:icon="@drawable/icon2"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.crm_executive.MainActivity"
            android:label="@string/app_name" >
        </activity>
</application>


That text is in your AndroidManifest.xml at android:label:

<application android:icon="@drawable/icon" android:label="@string/app_name">

You should change that string to fix your issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜