Skip to content Skip to sidebar Skip to footer

Relativelayout/customview Doesn't Fill Tab's Width

I'm trying to fill a tab with a view. For more information about the exact thing I try to achieve with the view please read my previous question : How to customize individual tabs?

Solution 1:

Those are paddings. Use the style below with your TabHost to get rid of them, or set android:paddingStart and android:paddingEnd to 0dp in your layout directly.

Android 4.0 and higher

<stylename="TabStyle"parent="@android:style/Widget.Holo.Light.ActionBar.TabView"><itemname="android:paddingStart">0dip</item><itemname="android:paddingEnd">0dip</item></style>

Older Android

<stylename="TabStyle"parent="@android:style/Widget.ActionBar.TabView"><itemname="android:paddingStart">0dip</item><itemname="android:paddingEnd">0dip</item></style>

Solution 2:

Make sure you are using the proper dpi (hdpi, mdpi, et.) folder for your background resources to match the device/emulator you are working on.

I was having the same problem as you, even if I was using a custom tab through setCustomView() method, overriding styles (w/support library as well) and even removing paddings from parent layouts.

Now works as I expected, hope it helps!

Post a Comment for "Relativelayout/customview Doesn't Fill Tab's Width"