Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set LayoutParams for Android 5.0 Toolbar #4

Open
jaredrummler opened this issue Dec 31, 2014 · 3 comments
Open

Set LayoutParams for Android 5.0 Toolbar #4

jaredrummler opened this issue Dec 31, 2014 · 3 comments

Comments

@jaredrummler
Copy link

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.

@Mirkoddd
Copy link
Owner

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

@IgorGanapolsky
Copy link

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

@indrora
Copy link

indrora commented Jul 7, 2015

Any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants