Skip to content Skip to sidebar Skip to footer

Android Actionbar.tab Setcustomview() Doesn't Fill_parent

I'm using ActionBar.Tab setCustomView() method with this layout: Copy

themes.xml:

<stylename="Theme.Custom"parent="@style/Theme.AppCompat.Light"><itemname="android:actionBarTabStyle">@style/Custom.ActionBar.TabView.Empty</item><itemname="actionBarTabStyle">@style/Custom.ActionBar.TabView.Empty</item></style>

Solution 2:

To every created tab object just add layoutParams:

..    
tab.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
actionBar.addTab(tab);

Solution 3:

You have to rely on android:margin and android:padding when dealing with actionbarcompat's setCustomView

keeping in mind that it seems like the root element's padding, width, height, and margin, gets ignored.

Solution 4:

If you're still having the issue, I found a way to get the whole space : ActionBar Tab with custom View not centered

Post a Comment for "Android Actionbar.tab Setcustomview() Doesn't Fill_parent"