Android TextInput 提示文本颜色 [英] Android TextInput hint text color

查看:29
本文介绍了Android TextInput 提示文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个 TextInputLayoutEditText 并且我的文本提示是黑色的,我想更改它.

顺便说一下,当提示出现在顶部时,它的颜色是白色

 

解决方案

你需要把android:textColorHint="@color/yourColor"放在TextInputLayout中,就像这样:

I have this TextInputLayout and EditText and my text hint is black color and I want to change it.

By the way when the hint is going on top its color is white

 <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout">

            <EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/prompt_password"
                android:imeActionId="@+id/login"
                android:imeActionLabel="@string/action_sign_in_short"
                android:imeOptions="actionUnspecified"
                android:inputType="textPassword"
                android:maxLines="1"
                android:singleLine="true"
                android:textColor="@android:color/white"
                android:textColorHint="@android:color/white" />

        </android.support.design.widget.TextInputLayout>

Styles

<style name="TextAppearance.App.TextInputLayout" parent="@android:style/TextAppearance">
    <item name="android:textColor">@android:color/white</item>
    <item name="android:textColorHint">@android:color/white</item>
    <item name="colorPrimary">@android:color/white</item>
    <item name="colorAccent">@android:color/white</item>
</style>

解决方案

You need to put the android:textColorHint="@color/yourColor" in the TextInputLayout, just like this:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
    android:textColorHint="@color/yourColor">

这篇关于Android TextInput 提示文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆