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

Floating Label Color doesn't change #187

Open
tfKamran opened this issue May 15, 2015 · 7 comments
Open

Floating Label Color doesn't change #187

tfKamran opened this issue May 15, 2015 · 7 comments

Comments

@tfKamran
Copy link

While using with Theme.AppCompat, it does not adapt with the theme.

Even with app:met_floatingLabelTextColor="#FFFFFFFF", it still remains dark and unreadable.

@dogo
Copy link

dogo commented May 15, 2015

yep, same here using this config:

            app:met_hideUnderline="true"
            app:met_floatingLabel="normal"
            app:met_floatingLabelAlwaysShown="true"
            app:met_accentTypeface="fonts/Roboto-Regular.ttf"
            app:met_floatingLabelTextColor="@android:color/black"
            app:met_primaryColor="@android:color/black" 

The floating text still grey

@sushant23
Copy link

Same Problem here :\

@MohHeader
Copy link

I have the same problem,
when the background is Dark, the FloatingLabel whatever I do is dark.

I think the problem comes from giving the FloatingLabel an alpha value,
Works perfect on light background, but don't in dark one.

By modifying this line,

int alpha = ((int) ((floatingLabelAlwaysShown ? 1 : floatingLabelFraction) * 0xff * (0.74f * focusFraction + 0.26f) * (floatingLabelTextColor != -1 ? 1 : Color.alpha(floatingLabelTextColor) / 256f)));

you can start to get better alpha, But I still have some problems to get it to work as I need.

@MohHeader
Copy link

for me to get it to work nice with Dark Background, I used

setFloatingLabel(FLOATING_LABEL_NORMAL);

and changed the code as follow :

// calculate the alpha
int alpha = ((int) ((floatingLabelAlwaysShown ? 1 : floatingLabelFraction) * 0xff * (0.74f * focusFraction + 0.26f) * (floatingLabelTextColor != -1 ? 1 : Color.alpha(floatingLabelTextColor) / 256f)));
if(!highlightFloatingLabel)
    alpha = ((int) ((floatingLabelAlwaysShown ? 1 : floatingLabelFraction) * 0xff * (0.74f * focusFraction + 1f) * (floatingLabelTextColor != -1 ? 1 : Color.alpha(floatingLabelTextColor) / 256f)));
textPaint.setAlpha(alpha);

I know this is a dirty workaround, But that what I reached so far

@MohHeader
Copy link

I also found that I have to give BaseColor,

@MohHeader
Copy link

Also I found something strange,

setBaseColor(Color.WHITE);
        setHintTextColor(Color.WHITE);
        setTextColor(Color.WHITE);

gives Different results from

        setHintTextColor(Color.WHITE);
        setTextColor(Color.WHITE);
setBaseColor(Color.WHITE);

@thientvse
Copy link

You can use with .setFocusFraction(1f); It work for me.

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

5 participants