user1987430
user1987430

Reputation: 53

How to decrease actionbar tabs width programmatically

How to manage the action bar tabs width.here attaching screen .

Upvotes: 1

Views: 2268

Answers (2)

codeFood
codeFood

Reputation: 1251

You can do that using Action Bar Tab style.

For Android version less than 14, add the following to your application theme;

<style name="Theme.Apptheme" parent="@style/Theme.AppCompat.Light">
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.Apptheme</item>
</style>

<style name="ActionBarTabStyle.Apptheme" parent="@style/Widget.AppCompat.ActionBar.TabView">
    <item name="android:paddingLeft">0dp</item>
    <item name="android:paddingRight">0dp</item>
</style>

For version 14 and onwards, refer the same.

    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Apptheme</item>

Upvotes: 0

iganev
iganev

Reputation: 128

You can try removing their default padding, by overriding the default style:

<style name="TabViewNoPadding" parent="@android:style/Widget.Holo.Light.ActionBar.TabView.Inverse">
    <item name="android:padding">0dp</item>
</style>

And then set this style in your app theme:

<item name="android:actionBarTabStyle">@style/TabViewNoPadding</item>

Upvotes: 1

Related Questions