TabBarView icon indicating copy to clipboard operation
TabBarView copied to clipboard

Set LayoutParams for Android 5.0 Toolbar

Open jaredrummler opened this issue 10 years ago • 3 comments

The Android 5.0 Toolbar adds extra padding, causing TabBarView to not match parent.

lollipop-tbv

Adding the following after calling super(context, attrs, defStyle); in TabBarView fixes the issue:

setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.MATCH_PARENT));

The material design guidelines show that no dividers should be used in tabs. I suggest you remove the dividers to match the new guidelines.

jaredrummler avatar Dec 31 '14 03:12 jaredrummler

Hello Jared (you are one of my favourites devs) , thanks for pointing me to this bug. A quick fix would be:

private static int ab;

public TabBarView(Context context) {
    this(context, null);
}

public TabBarView(Context context, AttributeSet attrs) {
    this(context, attrs, ab);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ab = 0;
    }else{
        ab = android.R.attr.actionBarTabBarStyle;
    }

}

for dividers;

public TabBarView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.MATCH_PARENT));

    }
         . . .
}

for the strip.

But I see there s no more highlight on press and text color is out of sync with the theme. I will fix it asap, thanks again

Mirkoddd avatar Dec 31 '14 09:12 Mirkoddd

Has Toolbar and Material Design been implemented in this project yet? Or is still using the old ActionBar...

IgorGanapolsky avatar Apr 17 '15 05:04 IgorGanapolsky

Any progress?

indrora avatar Jul 07 '15 00:07 indrora