CollapsingToolbarLayout not showing Title
Remove this
@Override
public void setTitle(CharSequence title) {
if (title != null && !title.toString().isEmpty()) {
mTitle = title.toString();
mCollapsingToolbarLayout.setTitle(mTitle);
}
}
and add this on your OnCreate()
.
mCollapsingToolbarLayout = (CollapsingToolbarLayout)findViewById(R.id.collapsing);
mCollapsingToolbarLayout.setTitleEnabled(false);
mToolbar.setTitle("title");
This disables the default title with collapsing behaviour and adds the static title to the toolbar.
For who searches for disabling the title just add
app:titleEnabled="false"
Then the title of the toolbar itself would appear so we will disable it with
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
or with those line in the style xml
<item name="android:displayOptions">showHome|useLogo</item>
<item name="displayOptions">showHome|useLogo</item>
Searched too much to make this search summary, wish it helps.