Application Title seen in the TOOLBAR

2

Currently I have the problem that the name of the application

 <string name="app_name">Banred</string>

I get it in the Toolbar of the main menu and I really do not want the name to be seen

My toolbar is as follows:

<android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:id="@+id/actionbar_toolbar"
        android:background="@color/white">
       <ImageView
           android:layout_width="100dp"
           android:layout_height="55dp"
           android:layout_marginTop="5dp"
           android:layout_centerHorizontal ="true"
           android:layout_gravity = "center"
           android:background="@mipmap/banred"
           />
    </android.support.v7.widget.Toolbar>

The OnCreate code is as follows

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_home);
    super.onCreate(savedInstanceState);

}

My Styles.xml is next

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>

</style>

since thank you very much

    
asked by Bruno Sosa Fast Tag 21.12.2017 в 19:12
source

3 answers

2

One solution is to remove it by code.

this code you must put it in your onCreate() in your main activity where you create your navigation drawer

if(getSupportActionBar() != null) {
    getSupportActionBar().setDisplayShowTitleEnabled(false);
}
    
answered by 21.12.2017 / 19:43
source
1

Find the activity in your manifest and assign it an empty string in the label parameter

< activity
 Android: name=". activitys.PrincipalActivity"
 android: label="" / >

    
answered by 26.12.2017 в 18:03
0

You are probably including that text from another part.

In my App, in fact, the name is included in the ToolBar. And it is included in the following way:

1. The layout of the Activity has this, in your case it would be activity_home.xml :

You should check if there is any include in that layout.

<include
    layout="@layout/app_bar_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

As you can see, it includes a layout called app_bar_main and it is there where a TextView is placed with the name of the App:

2. app_bar_main.xml

<TextView
    android:id="@+id/txt_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom|center"
    android:keepScreenOn="true"
    android:text="@string/app_name" />

If you delete that TextView , the name of the App will no longer appear in the ToolBar.

    
answered by 21.12.2017 в 19:50