Android app name not being displayed

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

    Even I noticed the same and seems that is a bug! You should report it to google :)

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

    You can directly give yours Application name to it like android:lable="app_name" or check yours String.xml file in Values folder

    0 讨论(0)
  • 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");
    
    0 讨论(0)
  • 2020-12-29 21:56

    I have the same problem, solution for me:

    on MainActivity.java change:

    public class MainActivity extends Activity {...}
    

    for

    public class MainActivity extends AppCompatActivity {...}
    
    0 讨论(0)
  • 2020-12-29 21:56

    If you are using Android studio, then you you should extend AppCompatActivity then only the Activity will be displayed.

    Example Code: Main Activity: public class MainActivity extends AppCompatActivity

    Styles.XML

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>
    

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

    You should replace

    <activity android:name=".Main"
              android:label="@string/title">
    

    with

    <activity android:name=".Main"
              android:label="@string/app_name">
    
    0 讨论(0)
提交回复
热议问题