在Android小部件TextInputLayout中,活动错误和提示的样式相同,例如
但是当错误打开时,我希望看到不同颜色的提示(黑色,而不是红色)。我该如何实现?
P.S。我已经尝试使用.setHintTextAppearance(R.style.StyleName)方法以编程方式应用样式,但是并没有带来任何效果
TextInputLayout的代码
<android.support.design.widget.TextInputLayout
android:id="@+id/editTextClient"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColorHint="@color/colorPrimaryText"
app:errorEnabled="true"
app:hintEnabled="true"
android:hint="@string/login"
app:errorTextAppearance="@style/ErrorAppearence"
app:hintTextAppearance="@style/TextLabel"
app:helperTextTextAppearance="@style/TextAppearance.AppCompat.Body2">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:textSize="14sp"
android:singleLine="true"
android:textColor="@color/colorPrimaryText"/>
</android.support.design.widget.TextInputLayout>
样式
<style name="TextLabel" parent="TextAppearance.Design.Hint">
<item name="android:textColor">@color/colorPrimaryText</item>
<item name="android:textSize">12sp</item>
</style>
<style name="ErrorAppearence">
<item name="android:textColor">@color/colorAccent</item>
<item name="android:textSize">12sp</item>
</style>