我可以使TextInputLayout上的标签文本颜色不同于editText提示文本颜色
<android.support.design.widget.TextInputLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layoutMargin16"
android:textColorHint="@color/green"
app:hintTextAppearance="@style/textLayoutInputSize">
<EditText
android:id="@+id/editTextFirstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layoutMargin16"
android:textColorHint="@color/blueColorButton"
android:hint="@string/first_name" />
</android.support.design.widget.TextInputLayout>
我有此代码,android:textColorHint="@color/blueColorButton"
如何为其设置文本颜色(与TextInputLayoutlabel不同的颜色)
Image 1
答案 0 :(得分:2)
您需要在
TextInputLayout
中设置主题。我附上一个示例。我希望它对您有用。
<android.support.design.widget.TextInputLayout
android:theme="@style/EditTextTheme">
</android.support.design.widget.TextInputLayout>
<style name="EditTextTheme" parent="TextAppearance.AppCompat">
<item name="android:textColorHint">@color/colorWhiteAlpha</item>
<item name="android:textSize">@dimen/font_16sp</item>
<item name="colorAccent">@color/colorWhite</item>
<item name="colorControlNormal">@color/colorWhiteAlpha</item>
<item name="colorControlActivated">@color/colorWhiteAlpha</item>
<item name="android:textColorHighlight">@color/colorWhiteAlpha</item>
<item name="android:textColorLink">@color/colorWhiteAlpha</item>
</style>