Android app name not being displayed

前端 未结 13 2242
梦谈多话
梦谈多话 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:54

    you need

    public class MainActivity extends AppCompatActivity {.....}
    

    if you can't extend AppCompatActivity, then you can alternatively add the last line of the code below to show a title in the bar..

       protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle("the name i want to appear");
    

提交回复
热议问题