Android remove spaces between tabs in tabwidget
I have made an application which have these tabs.I want to show tabs in my application but by default in android like this.
But i want to show tabs like this
So i want to remove the divider line and space between two tabs and also by default the tabs background color is gray color. so i want to change this into White color.
Please tell how to remove divider line and space between two tabs and change the background color of tabs.
I am follow this link to make the tabwidget http://www.mkyong.com/android/android-tablayout-example/
to remove strip in tabhost an
remove diver line, and use customview to change background color.
You will have to take advantage of the following on the TabWidget:
setDividerDrawable(null); //Or provide your own divider here as needed
as well as modifying the background drawable for the Tabs.
If you decide not to do this programmatically, then Override the class and create your own version of the tab that you would like to reference instead of the default class and put those into your XML layout file instead.
Here is a simple solution:
<android.support.design.widget.TabLayout app:tabPaddingStart="0dp" app:tabPaddingEnd="0dp" />
Since the tab structure uses drawables to display the graphics you see, you can simply replace them with custom graphics. In your case, with transparent, or white ones (depending on what you want to do with them)
Implementing a custom style for the tab would be the best way to do it. I'd start with these elements:
<item name="android:divider">@drawable/MY_DIVIDER</item> <item name="android:background">@drawable/MY_TAB_BACKGROUND</item> <item name="android:dividerPadding">0 dp</item>