Skip to content Skip to sidebar Skip to footer

How To Set A Custom View In Actionbar's Navigation Tabs And Make The Tabs Adapt To Its Height?

I'm using the ActionBar and I want to set a custom View in the navigation tabs. The height of the tabs seem to be fixed, and my custom View is larger, so it does not fit. I try to

Solution 1:

this keep the actionbar on the top, but i don't know why !

ActionBar.DISPLAY_SHOW_HOME

the actionbar stay in the top :

actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM  | ActionBar.DISPLAY_SHOW_HOME);

the tabs go on the top of the actionbar :

actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM 

Solution 2:

AFAIK, you can't change the height of the action bar tabs. But you can achieve the intended behaviour by using a TabHost along with a ViewPager. This way you can add custom views to your TabIndicators and also have the swiping functionality.

Post a Comment for "How To Set A Custom View In Actionbar's Navigation Tabs And Make The Tabs Adapt To Its Height?"