How to style com.google.android.material.textfield.TextInputLayout such that error message and hint colour,by default both colors are same red ,can be changed.I tried below code,but both error message and hint colour change
以下是app:errorTextAppearance的样式
<style name="TextErrorAppearanceError" parent="TextAppearance.Design.Error">
<!-- Error message appearance here -->
<item name="android:colorError">@color/color3</item>
<item name="android:textSize">12sp</item>
<item name="android:textColor">@color/color2</item>
<item name="android:fontFamily">@font/fontfamily</item>
</style>
还在将错误设置为textInputLayout之前尝试了以下代码 edTextEdit.setHintTextColor(resources.getColor(android.R.color.holo_green_dark))
答案 0 :(得分:0)
在styles.xml
中
<style name="error_appearance" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/colorCoralPink</item>
<item name="android:textSize">12sp</item>
</style>
在您的TextInputLayout
中进行
app:errorTextAppearance="@style/error_appearance"
希望这会有所帮助。