For Changing the border color and hintTextColor, you can use
app:boxStrokeColor="your color"
app:hintTextColor="your color" /*This changes the color of hint when it's collapsed
and moved to top that's when user enters a character.*/
app:textColorHint="your color" //This is the text color of uncollapsed hint that's the default state.
Furthermore, if you want to create a style then this is the complete style I use which you can modify as you need.
<style name="TextInputLayoutAppearanceOutLined" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="hintTextAppearance">@style/HintText</item>
<item name="helperTextTextAppearance">@style/HelperText</item>
<item name="counterTextAppearance">@style/HelperText</item>
<item name="android:textColor">@color/dark_grey</item>
<item name="android:textColorHint">@color/dark_grey</item>
<item name="hintTextColor">@color/colorAccent</item>
<item name="boxStrokeColor">@color/colorAccent</item>
<item name="startIconTint">@color/colorAccent</item>
<item name="endIconTint">@color/colorAccent</item>
<item name="boxBackgroundColor">@color/white</item>
<item name="boxCornerRadiusBottomEnd">10dp</item>
<item name="boxCornerRadiusBottomStart">10dp</item>
<item name="boxCornerRadiusTopEnd">10dp</item>
<item name="boxCornerRadiusTopStart">10dp</item>
<item name="boxStrokeWidthFocused">2dp</item>
<item name="hintEnabled">true</item>
<!--<item name="hintAnimationEnabled">true</item>-->
</style>
These are the style elements to change HelperText or HintText apperance:
<style name="HintText" parent="TextAppearance.Design.Hint">
<item name="android:textSize">12sp</item>
</style>
<style name="HelperText" parent="TextAppearance.Design.HelperText">
<item name="android:textSize">12sp</item>
</style>
And set it to TextInputlayout
as style="@style/TextInputLayoutAppearanceOutLined"
. Whatever mentioned in the style, you can use it in XML layout tag as well.
Also, the official docs of Material TextInputLayout
are very important and easy to understand unlike the developer docs of Android and you should read them once to know more about it here.