How to remove app title from toolbar?

You can use toolbar.setTitle(""); Or you can simply set the android:label="" for your Activity in the AndroidManifest.xml


This is my gradle:

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.example.zumoappname"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

and this is my activity:

 public class MainActivity extends AppCompatActivity {
 .....

The following code works very nice for me:

Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
myToolbar.setTitle("");
setSupportActionBar(myToolbar);

Try this,

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        //toolbar.setNavigationIcon(R.drawable.ic_toolbar);
        toolbar.setTitle("");
        toolbar.setSubtitle("");
        //toolbar.setLogo(R.drawable.ic_toolbar);

If still doesn't works just use setNavigationIcon() & setLogo() and that should replace the title. If you are facing any crashes please post the crash report.


Try this:

getSupportActionBar().setDisplayShowTitleEnabled(false);

Tags:

Android