سؤال

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