Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number of tabs in ActionBar

Android's ActionBar has a mode NAVIGATION_MODE_TABS. Using ActionBarSherlock 3.5.1 I have set this ActionBar and addded 5 tabs. On 2.x devices I see all tabs without horizontal scrolling. On 4.0.x I see only 3 tabs with scrollable layout. NAVIGATION_MODE_TABS of ActionBar can contain max 3 tabs in ICS? If yes, could I hack this somehow? I know, i could create custom TabHost, but it would be quite time consuming to implement it with ViewPager between tab views.

2.x devices

4.0.X devices

like image 849
sealskej Avatar asked Jan 04 '12 12:01

sealskej


1 Answers

You don't need to hack anything. The ActionBar tabs have specific layout parameters that you can change pretty easily through a custom style. Google uses their own style to set them in the first place. You should take a look at this on creating custom styles. http://android-developers.blogspot.com/2011/04/customizing-action-bar.html Since you want them to look like they way Jake Wharton has them set in ActionBarSherlock, then you could make things even easier for yourself and just rip his styles out.

like image 190
adneal Avatar answered Nov 12 '22 10:11

adneal