我有一个TextInputLayout,里面有TextInputEditText。现在,当没有输入任何东西时,我将它带有灰色的提示颜色,一旦用户在其上键入并且提示变小并且向上移动(正常动画),提示颜色变为蓝色。问题是,一旦我点击另一个edittext,第一个的提示再次变为灰色,我希望它保持蓝色。
这是我的代码:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/textInputLayoutAppearance">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:hint="@string/str_usuario"/>
</android.support.design.widget.TextInputLayout>
和风格:
<style name="textInputLayoutAppearance" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/blue</item>
</style>
提前致谢..
答案 0 :(得分:0)
您可以如下指定提示颜色-
<android.support.design.widget.TextInputLayout
android:id="@+id/til_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/parent_to_view_margin"
app:layout_constraintTop_toBottomOf="@+id/til_email">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@android:color/holo_blue_bright"
android:hint="@string/hint_password" />
</android.support.design.widget.TextInputLayout>