android - Fragment have 2 toolbars, its own and that of activity -
i have homeacivity 4 fragments. 3 of fragments have no toolbar of own , showing activity's toolbar in them. however, 4th fragment have toolbar of own.
currently seeing 2 toolbars in 4th fragment, 1 own , other of activity.how can hide activity's toolbar , show own toolbar?
please note don't want update content of activity's toolbar instead of showing new toolbar inside fragment. want show fragments own toolbar , hide of activity.
please me out.
you can hide activity's toolbar 4th fragment
@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view rootview = inflater.inflate(r.layout.fragment_view, container, false); ((toolbarview)getactivity().findviewbyid(r.id.toolbarview)).setvisibility(view.gone); return rootview; }
and show activity's toolbar other 3 fragments
@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view rootview = inflater.inflate(r.layout.fragment_view, container, false); ((toolbarview)getactivity().findviewbyid(r.id.toolbarview)).setvisibility(view.visible); return rootview; }
Comments
Post a Comment