Android app name not being displayed

前端 未结 13 2124
梦谈多话
梦谈多话 2020-12-29 20:53

My Android app is not displaying the application name \"app_name\", instead its displaying the activity name \"title\". This is from my manifest file;

   <         


        
相关标签:
13条回答
  • 2020-12-29 21:40

    You can just set your launcher activitys label as the app name and then set the actionBar title manually in code for that activity

    getSupportActionBar().setTitle(R.string.title_user_login);
    

    This is of course if you are using an action bar. Normal activity title headings are ugly anyway!

    EDIT: saying that you can see the text change on start up!

    0 讨论(0)
  • 2020-12-29 21:41

    If you or somebody is still facing the problem then here is the solution which worked for me.

    Keep the Application label and Main activity label same in manifest as shown below

    <application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".Main"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    

    in main.java file set the label of your activity as shown below (I guess you are using action bar)

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getResources().getString(R.string.title));
    

    before installing this changed app, uninstall the previous version reboot your phone and now install the changed app.

    I hope this helps.

    0 讨论(0)
  • 2020-12-29 21:46

    Use

    this.setTitle("");
    

    in your onCreate() method of your activity and use your prefered application name in the @string/app_name for

    <application> android:lable = "@string/app_name" </application>
    
    0 讨论(0)
  • 2020-12-29 21:46

    If you are using Android studio, also you are using MapsActivity then you should extend ActionBarActivity, also put app name at String.xml. It's works for me. thanks

    <resources>
    <string name="app_name">App Name</string>
    <string name="title_activity_maps">Map</string>
    

    0 讨论(0)
  • 2020-12-29 21:49

    You can only display one label at a time. Application label or Activity label.

    If you set a label and run an activity, you will see the Activity label.

    To see Application label, doesn't set android:label="@string/title" on Main activity.

    0 讨论(0)
  • 2020-12-29 21:51

    In all activities you should change the value of

     android:label 
    

    to

     "@string/app_name"
    

    UPDATED:

    well the answer is that The First Activity with the label @string/title is your main activity which comes on the Launcher menu . So you have to set the label to that activity. Other Solution is that You create a Temp Activity and Call you Main Activity from there and set Your Main Activity the title Label and your Temp activity the App_name label and make your Temp Activity the Main Launcher.

    Hope this Helps

    Thanks

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