java - Custom action bar for each fragment - not menu -


let me explain first: application planed use 3 activities swipe navigation. using different sherlock action bar each 1 of them.

but since not possible swipe between activities, solution work fragments. implemented that, came across problem: possible customize action bar each fragment? because i'm stuck one. i've googled , every solution based on menu, possible apply custom styles menus , in fragments?

sorry if answered, haven't found solution online.

is possible use kind of approach?

public class controlactivity extends sherlockfragmentactivity {

actionbar actionbar; view actionbarview;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.viewpager_layout);     viewpager pager = (viewpager) findviewbyid(r.id.viewpager);     pager.setadapter(new mypageradapter(getsupportfragmentmanager()));     actionbar = getsupportactionbar();     actionbarview= getlayoutinflater().inflate(             r.layout.friend_list_ab_layout, null);     actionbar.setcustomview(actionbarview);   } private class mypageradapter extends fragmentpageradapter {      public mypageradapter(fragmentmanager fm) {         super(fm);     }     @override     public sherlockfragment getitem(int pos) {         switch(pos) {              case 0:                 actionbarview= getlayoutinflater().inflate(                         r.layout.friend_list_ab_layout, null);                 actionbar.setcustomview(actionbarview);                 return mainactivity.newinstance();             case 1:                 actionbarview= getlayoutinflater().inflate(                         r.layout.news_feed_ab_layout, null);                 actionbar.setcustomview(actionbarview);                 return newsfeed.newinstance();             default:                 actionbarview= getlayoutinflater().inflate(                         r.layout.friend_list_ab_layout, null);                 actionbar.setcustomview(actionbarview);                 return mainactivity.newinstance();         }     }     @override     public int getcount() {         return 2;     } } 

}

well can build own action bar, mean should create dynamic fragment , use @ action bar , give styling action bar, use frame layout plcaeholder fragment , when swipe fragment replace actionbar fragment new 1


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -