'Why can't I set app:helperTextTextColor="@color/red"?
I'm currently watching a tutorial on how to create the "Required*" helper text on a textInputLayout. In the video he is able to set the text color to red using the code below, but when i try to do it, the only colors available are black, teal, white and purple.
in activity_main.xml:
<com.google.android.material.textfield.TextInputLayout
...
app:helperText="Required*"
app:helperTextTextColor="@color/red"
...
>
sorry if the format of my question is wonky, this is my first ever post.
Solution 1:[1]
@color/ refers to a named color in the colors.xml resource In app / res / values you may have a file colors.xml You may only have the 4 entries you mention defined.
Example contents:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="yellow">#FFFF00</color>
<color name="fuchsia">#FF00FF</color>
<color name="red">#FF0000</color>
<color name="silver">#C0C0C0</color>
<color name="gray">#808080</color>
<color name="olive">#808000</color>
</resources>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | DarkWing |