Number of tabs in ActionBar

Android ActionBar has NAVIGATION_MODE_TABS mode. Using ActionBarSherlock 3.5.1 I set this tab to ActionBar and added 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. Can the NAVIGATION_MODE_TABS ActionBar contain a maximum of 3 tabs in ICS? If so, can I somehow crack this? I know I could create a custom TabHost , but it would take quite a while to implement it with a ViewPager between tabs.

2.x devices

4.0.X devices

+6
source share
2 answers

You do not need to hack anything. ActionBar tabs have specific layout options that you can easily change using a custom style. Google uses its own style to set them first. You should take a look at this when creating custom styles. http://android-developers.blogspot.com/2011/04/customizing-action-bar.html Since you want them to look like they do Jake Wharton, they are set to ActionBarSherlock, then you can make things even easier for yourself and just tear out his styles.

+2
source

I had the same issue with the action bar stud and this post helped me.
How to control the width of ActionBar navigation tabs?

An important part

 <style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar"> <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item> <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item> </style> 
0
source

Source: https://habr.com/ru/post/905092/


All Articles