I\'m trying to customize Tabs on my ActionBar. I just want to align tabs to phone screen and make it stretchable for various screens. But all I get is this:
You can use the setCustomView method.
I have found using style guides for the tabs to very inconsistent for honeycomb, It was much easier to just inflate a custom view that does want you want.
Fragment serivceFrag = new ServicesFragment();
Tab serviceTab = bar.newTab();
TextViewPlus serviceTabTextView =(TextViewPlus)getLayoutInflater().inflate(R.layout.tab_item_layout, null);
serviceTabTextView.setText(servicesLabel);
serviceTab.setCustomView(serviceTabTextView);
serviceTab.setTabListener(new TabListenerFragment(serivceFrag,"Service",R.id.MainInfoPaneFragment));
bar.addTab(serviceTab);
This to me was much simpler,
Change to:
<style name="MyActionBarTabTextStyle" parent="@android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textSize">14dip</item>
<item name="android:padding">0dip</item>
</style>
I strongly recommend that you use ViewPagerExtensions library, it give you 5 different styled tabs to you choose from, also the problem that you have to fill tabs in portrait and landscape ,ode for each screen size is already solved in this library.
By the way, if you look inside the library´s code, you can easy theme this yourself.
Also, if you have trouble implementing this with fragment page, look actionbarsherlock-tabs-multi-fragments
There's a brand new tool to generate the correct 9patch images for the actionbar : http://jgilfelt.github.com/android-actionbarstylegenerator/
I think you're inheriting from the wrong style, try:
<style name="MyActionBarTabTextStyle" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textSize">14sp</item>
<item name="android:padding">0dip</item>
</style>
EDIT: also, make sure you use sp instead of dip for font size (14sp)