TextInputLayout淡淡的颜色

TextInputLayout淡淡的颜色

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

问题描述

我使用的是谷歌的新设计库(com.android.support:design:22.2.0),我有问题的 android.support.design.widget.TextInputLayout

I'm using new Google design library (com.android.support:design:22.2.0) and I have problem with android.support.design.widget.TextInputLayout.

如果我编程设置的EditText上,飘淡淡的颜色是灰色的,而不是强调色。如果用户填写字段(EditText上)本身它的工作原理,或者如果他改变preddefined领域的价值。

If I set its EditText programmatically, floating hint color is gray instead of accent color. It works if user fills field (EditText) itself or if he changes preddefined value of field.

这是我的code:

<android.support.design.widget.TextInputLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent">
        <EditText
            android:id="@+id/register_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/register_username"
            android:inputType="text"/>
</android.support.design.widget.TextInputLayout>

用户之后点击一些按钮,它通过的setText填充字段(EditText上的)方法和浮动提示变成灰色。难道是错误还是我失去了一些东西?

After user clicks some button it fill field via setText() method of EditText and floating hint becomes gray. Is it bug or I'm missing something?

推荐答案

使用android.support.v7.widget.AppCompatEditText代替的EditText和你的问题应该得到解决。另外,请确保您的摇篮设置如下所示:

Use android.support.v7.widget.AppCompatEditText instead of EditText and your problems should be resolved. Also make sure your gradle settings are as follows below:

compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:design:22.2.0'

这篇关于TextInputLayout淡淡的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 04:22