Colors in attrs.xml too
I'm very confused why the colors are handled over the colors.xml file instead like the texts via the attributes file?
We can set it up like this too:
<declare-styleable name="MaterialLoginView">
<attr name="loginTitle" format="string" />
<attr name="loginHint" format="string" />
<attr name="loginPasswordHint" format="string" />
<attr name="loginActionText" format="string" />
<attr name="loginTextColor" format="reference" />
<attr name="registerTitle" format="string" />
<attr name="registerHint" format="string" />
<attr name="registerPasswordHint" format="string" />
<attr name="registerRepeatPasswordHint" format="string" />
<attr name="registerActionText" format="string" />
<attr name="registerTextColor" format="reference" />
<attr name="registerIcon" format="reference" />
</declare-styleable>
and use it like
app:loginTextColor="@color/material_login_register_color"
Any opinion not to do this?
Great question, I've struggling it for a few hours how to do it right, even ask on SO.
I can't just pass the color as an attribute to the view because this color is showing up in a couple of places, for example- the "login" color is in the view background, in the text style and in the login button background drawable, so I preferred putting it all in the xml's and not in code (and there are some things that I can event not set up in code, like the hint text style)
Ok, all right :point_up_2:
But would it be better when we create a style like
MaterialLoginThemeLight.ColorScheme and MaterialLoginThemeDark.ColorScheme to override the colors in styles.xml?
So the user will be able to inheritance from those styles? If so- we'll need to create also LightDarkActionBar or more for some custom styles, am I right?
Isn't it better just use the color like we do now?