简体   繁体   中英

how to add tabs to a SherlockFragment, not in a SherlockFragmentActivity

I am working in a project,that has tabs to the bottom of the page. In one particular tab, I have to replace the existing Fragment with a ShelockFragment . Now the fact is when I am trying to create the actionbar in my sherlockfragment code, I am not getting the getSupportActionBar (), which I get from a SherlockFragmentActivity . how can I overcome the situation ? I cant change my SherlockFragment to be a SherlockFragmntActivity . Because doing that wont let me replace my existing fragment to be replace by the sherlockFragment .

I have only one portion to use sherlock actionbar .

Please help me !!!

1) Parent layer (All Tabs are here) -EXTENDS SherlockFragmentActivity ; 2) Its child (class[OR tab] where u want to use actionbar, ie CLASS holding actionbar )- EXTENDS SherlockFragment [HERE NEED NOT HOLD ACTIONBAR] ; 3) Your actionbar -EXTENDS SherlockFragment ;

You need not to get getSupportActionBar() in ur (2nd class ie TAB class). Just define it in Parent Class(1st pt.) and let it hold ur action bar there. When required tab is taped just show those actionbars and in other cases HIDE these actionbar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM