简体   繁体   中英

Style Top & Bottom Part of Divider for Tab Widget

在此输入图像描述

I have a TabWidget and I'm trying to style the divider. (See image above)

I set the Divider Drawable of the TabWidget but the top & bottom part is unchanged. I can't figure out how to style it.

All you need to do is set the dividerPadding attribute to 0dp in your TabWidget .

android:dividerPadding="0dp"

Also, maybe consider switching to ActionBar.Tabs instead, just considering TabWidget is deprecated.

It seems that Holo theme has default 16 pixels dividerPadding for each TabWidget. I try to set it to zero in the XML but it is not working. Fortunately, it works for me to set it dynamically as below

myTabHost.getTabWidget().setDividerPadding(0);

Note: I am using android.support.v4.app.FragmentTabHost

are you talking about grey bars on the top and the bottom of the divider? use fill_parent for the drawable's height and width if that is the case!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM