Naming my application in android

后端 未结 3 1986
我寻月下人不归
我寻月下人不归 2020-11-27 16:43

I think I\'m getting senile because I was convinced that to give a name to your application, you had to fill this part of the manifest:



        
3条回答
  •  执笔经年
    2020-11-27 17:06

    It is an already known issue of the tool (I suppose you are using eclipse). Google Group - Android Developers.

    The Application and the first Activity share the same name specified in the android:label field of the item.

    If you want to use different titles for the launcher in the app list and the first activity, you can choose between these options:

    1.a) Set just the Application name in the Manifest.

    
    

    and don't specify android:label="@string/title_first_activity" for the first Activity. It will inherit the Application label.

    OR

    1.b) Set the Application name in the android:label field of the first Activity in the Manifest.

     
                
                      
                      
                
     
    

    The item will share the same label of the item, whether you specify a value for the 's android:label field or not.

    The next step is:

    2) Set the title for the first Activity at run-time in the FirstActivity.class

    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            setContentView(R.layout.activity_login);
            setTitle(R.string.title_activity_login);
            //TODO: insert the rest of the code
    }
    

    In this way your first Activity will change his title few moments after it will be shown on the screen of your phone.

提交回复
热议问题