android - Using Toolbar in Fragment or in Activity -


i using android-observablescrollview library. works great, have activity holding fragments, views encapsulated in fragment. in activity there framelayout holding fragments.
need use toolbar in application, have several ideas how implement this.

  1. use toolbar in activity, in case layout have framelayout , toolbar. in way have communicate activity whenever need toolbar, can obtain using getsupportedactionbar() fragment.

  2. use toolbar inside fragment (in layout) setting in each fragment view creation. , each time change fragment have add new toolbar activity. in fragment going have different toolbars not in all. approach store toolbar inside fragment.

the problem can see in using second approach, if there more 1 fragment on screen there several toolbars.

please suggest right way in case.
thank you.

you should use first method. while using first method have less problem second 1 because in second method have define toolbar many times not programming.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -