With the new Design Library, we\'re supposed to set the toolbar title on the CollapsingToolbarLayout, not the Toolbar itself(at least when using th
Okay I have a workaround while we wait for Google:
Grab the gist from https://gist.githubusercontent.com/blipinsk/3f8fb37209de6d3eea99/raw/b13bd20ebb319d94399f0e2a0bedbff4c044356a/ControllableAppBarLayout.java (I'm not the original creator but kudos to original author). This adds a few methods to the AppBarLayout, namely expand and collapse
In your method that calls setTitle():
collapsingToolbar.setTitle("All Recent");
getSupportActionBar().setTitle("All Recent");
collapseThenExpand();
collapseThenExpand() method:private void collapseThenExpand() {
appbar.collapseToolbar();
Handler h = new Handler();
h.postDelayed(new Runnable() {
@Override
public void run() {
appbar.expandToolbar(true);
}
}, 800);
}
Note you can turn off the expand animation by setting it to false.