I have a problem with action bar tabs, I would like to remove the padding left or right in tabs.
I tried this style, but it didn't work :
<!-- indicator tab color -->
<style name="ActionBarTabBarStyle" parent="@style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">@drawable/tab_indicator_ab_example</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
</style>
Do you have any idea?
You can achieve the look your looking for by configuring the 'Widget.Sherlock.Light.ActionBar.Solid.Inverse'. Specifically padding and minWidth on the TabView and the backgroundStacked.
<style name="GPA_Sherlock_theme" parent="@style/Theme.Sherlock.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/ActionBar.Solid.Example</item>
<item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Example</item>
<item name="actionBarStyle">@style/ActionBar.Solid.Example</item>
<item name="actionBarTabStyle">@style/ActionBarTabStyle.Example</item>
</style>
<style name="ActionBarTabStyle.Example" parent="@style/Widget.Sherlock.ActionBar.TabView">
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:minWidth">0dp</item>
</style>
<style name="ActionBar.Solid.Example" parent="@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="android:backgroundStacked">@drawable/ab_stacked_solid_example</item>
<item name="backgroundStacked">@drawable/ab_stacked_solid_example</item>
</style>
Add app:tabPaddingStart="0dp"
and app:tabPaddingEnd="0dp"
to TabLayout.
It works for me.
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabPaddingStart="0dp"
app:tabPaddingEnd="0dp"
app:tabIndicatorColor="#FF0000"
app:tabMode="fixed" />
and add xmlns:app="http://schemas.android.com/apk/res-auto"
to parent layout
You can use custom layout..
ActionBar actionBar;
actionBar = getActivity().getActionBar();
actionBar.setCustomView(R.layout.your_layout);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With