I have ActionBarActivity
with NavigationDrawer
and use support_v7 Toolbar
as ActionBar. In one of my fragments toolbar has custom view. In other fragments Toolbar
should show title.
How get Toolbar
instance for customizing from fragments? I can get ActionBar with getActivity().getActionBar()
, but if I call setTitle()
for this instance ActionBar it do nothing.
UPD:
In my case
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle();
(as MrEngineer13 said) don't work at first fragment creation because I call it from onHiddenChanged(). Now I add more one to onCreateView() and it works fine.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…