Вопрос

I have a Actionbar Tab with icon and text:

actionBar.addTab(actionBar.newTab()
              .setText("Tab1")
              .setIcon(R.drawable.image));

I want add a "10dp" padding between the icon and text of the tab and use "styles":

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

and

<style name="MyTabStyle" parent="AppTheme">
    <item name="android:paddingLeft">10dp</item>
    <item name="android:paddingRight">10dp</item>
</style>

Example:

(image)Tab1 --> (image)"10dp"Tab1

I solved momentarily with: .setText(" Tab1")

Это было полезно?

Решение

Try with margin or layout_margin :

    <style name="MyTabStyle" parent="AppTheme">
        <item name="android:layout_marginLeft">10dp</item>
        <item name="android:layout_marginRight">10dp</item>
    </style>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top