Что касается нового TextInputLayout, выпущенного Google, как изменить цвет текста с плавающей меткой?
Настройка colorControlNormal, colorControlActivated, colorControlHighLight в стилях не помогает.
Это то, что у меня есть сейчас:
 
Что касается нового TextInputLayout, выпущенного Google, как изменить цвет текста с плавающей меткой?
Настройка colorControlNormal, colorControlActivated, colorControlHighLight в стилях не помогает.
Это то, что у меня есть сейчас:
 
Попробуйте приведенный ниже код, он работает в нормальном состоянии
 <android.support.design.widget.TextInputLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:theme="@style/TextLabel">
     <android.support.v7.widget.AppCompatEditText
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:hint="Hiiiii"
         android:id="@+id/edit_id"/>
 </android.support.design.widget.TextInputLayout>
В папке стилей TextLabel Code
 <style name="TextLabel" parent="TextAppearance.AppCompat">
    <!-- Hint color and label color in FALSE state -->
    <item name="android:textColorHint">@color/Color Name</item> 
    <item name="android:textSize">20sp</item>
    <!-- Label color in TRUE state and bar color FALSE and TRUE State -->
    <item name="colorAccent">@color/Color Name</item>
    <item name="colorControlNormal">@color/Color Name</item>
    <item name="colorControlActivated">@color/Color Name</item>
 </style>
Установить на основную тему приложения, оно работает только выделить только состояние
 <item name="colorAccent">@color/Color Name</item>
Обновить:
UnsupportedOperationException: невозможно преобразовать в цвет: type = 0x2 в API 16 или ниже
<style name="TextAppearance.App.TextInputLayout" parent="@android:style/TextAppearance">
    <item name="android:textColor">@color/red</item>
    <item name="android:textSize">14sp</item>
</style>
<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textColorHint="@color/gray"  //support 23.0.0
    app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout" >
    <android.support.v7.widget.AppCompatEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/hint" />
</android.support.design.widget.TextInputLayout>
Найден ответ, используйте атрибут android.support.design:hintTextAppearance, чтобы установить свой собственный вид плавающей метки.
Пример:
<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:hintTextAppearance="@style/TextAppearance.AppCompat">
    <EditText
        android:id="@+id/password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/prompt_password"/>
</android.support.design.widget.TextInputLayout>
Вам не нужно использовать android:theme="@style/TextInputLayoutTheme" для изменения цвета плавающей метки, поскольку это повлияет на всю тему для небольшого TextView, используемого в качестве метки. Вместо этого вы можете использовать app:hintTextAppearance="@style/TextInputLayout.HintText" где:
<style name="TextInputLayout.HintText">
  <item name="android:textColor">?attr/colorPrimary</item>
  <item name="android:textSize">@dimen/text_tiny_size</item>
  ...
</style>
Сообщите мне, если решение работает: -)
Итак, я нашел этот ответ очень полезным и благодаря всем людям, которые внесли свой вклад. Просто что-то добавить. Принятый ответ действительно правильный ответ... НО... в моем случае я искал, чтобы выполнить сообщение об ошибке ниже виджета EditText с app:errorEnabled="true", и эта единственная строка осложнила мне жизнь. кажется, что это переопределяет тему, которую я выбрал для android.support.design.widget.TextInputLayout, которая имеет другой цвет текста, определенный android:textColorPrimary.
В конце концов я применил цвет текста непосредственно к виджету EditText. Мой код выглядит примерно так:
 styles.xml
<item name="colorPrimary">@color/my_yellow</item>
<item name="colorPrimaryDark">@color/my_yellow_dark</item>
<item name="colorAccent">@color/my_yellow_dark</item>
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:textColorSecondary">@color/dark_gray</item>
<item name="android:windowBackground">@color/light_gray</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:textColorHint">@color/dark_gray</item>
<item name="android:colorControlNormal">@android:color/black</item>
<item name="android:colorControlActivated">@android:color/white</item>
И мой виджет:
<android.support.design.widget.TextInputLayout
        android:id="@+id/log_in_layout_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:errorEnabled="true">
        <EditText
            android:id="@+id/log_in_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:textColor="@android:color/black"
            android:ems="10"
            android:hint="@string/log_in_name"
            android:inputType="textPersonName" />
</android.support.design.widget.TextInputLayout>
Теперь он отображает черный текст вместо белого textColorPrimary.
Я предлагаю вам создать тему стиля для TextInputLayout и изменить только цвет акцента. Установите родительский элемент в базовую тему приложения:
 <style name="MyTextInputLayout" parent="MyAppThemeBase">
     <item name="colorAccent">@color/colorPrimary</item>
 </style>
 <android.support.design.widget.TextInputLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:theme="@style/MyTextInputLayout">
как изменить цвет текста плавающей метки?
С библиотекой компонентов материалов вы можете настроить TextInputLayout цвет текста подсказки, используя (для этого требуется версия 1.1.0)
В макете:
app:hintTextColor атрибут: цвет метки, когда она свернута и текстовое поле активноandroid:textColorHint атрибут: цвет надписи во всех других состояниях текстового поля (например, в состоянии покоя и отключен)<com.google.android.material.textfield.TextInputLayout
     app:hintTextColor="@color/mycolor"
     android:textColorHint="@color/text_input_hint_selector"
     .../>
Widget.MaterialComponents.TextInputLayout.*:<style name="MyFilledBox" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
    <item name="hintTextColor">@color/mycolor</item>
    <item name="android:textColorHint">@color/text_input_hint_selector</item>
</style>
Селектор по умолчанию для android:textColorHint:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:alpha="0.38" android:color="?attr/colorOnSurface" android:state_enabled="false"/>
  <item android:alpha="0.6" android:color="?attr/colorOnSurface"/>
</selector>
В последней версии библиотеки поддержки (23.0.0+) TextInputLayout в XML используется следующий атрибут для изменения цвета плавающей метки: android:textColorHint="@color/white"
Вместо ответа Брахмана Ямани я предпочитаю использовать Widget.Design.TextInputLayout в качестве родителя. Это гарантирует, что присутствуют все необходимые элементы, даже если не все элементы перезаписаны. В ответе Yamanis приложение будет аварийно завершено с неразрешимым ресурсом, если вызывается setErrorEnabled (true).
Просто измените стиль следующим образом:
<style name="TextLabel" parent="Widget.Design.TextInputLayout">
    <!-- Hint color and label color in FALSE state -->
    <item name="android:textColorHint">@color/Color Name</item> 
    <item name="android:textSize">20sp</item>
    <!-- Label color in TRUE state and bar color FALSE and TRUE State -->
    <item name="colorAccent">@color/Color Name</item>
    <item name="colorControlNormal">@color/Color Name</item>
    <item name="colorControlActivated">@color/Color Name</item>
 </style>
 В моем случае я добавил это " app:hintTextAppearance="@color/colorPrimaryDark" в мой виджет TextInputLayout.
Изменить цвет подсказки и изменить текст подчеркивания color: colorControlActivated
Чтобы изменить цвет счетчика: textColorSecondary
Чтобы изменить цвет сообщения об ошибке: colorControlNormal
Чтобы изменить значок видимости пароля: colorForeground
Подробнее о TextInputLayout читайте http://www.zoftino.com/android-textinputlayout-tutorial
<style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorControlActivated">#e91e63</item>
    <item name="android:colorForeground">#33691e</item>
    <item name="colorControlNormal">#f57f17</item>
    <item name="android:textColorSecondary">#673ab7</item>
</style>
вы должны изменить свой цвет здесь
<style name="Base.Theme.DesignDemo" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#673AB7</item>
        <item name="colorPrimaryDark">#512DA8</item>
        <item name="colorAccent">#FF4081</item>
        <item name="android:windowBackground">@color/window_background</item>
    </style>
Теперь просто используя colorAccent и colorPrimary будет работать отлично.
Я решаю проблему. Это макет:
 <android.support.design.widget.TextInputLayout
           android:id="@+id/til_username"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:hint="@string/username"
           >
           <android.support.v7.widget.AppCompatEditText android:id="@+id/et_username"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:singleLine="true"
               />
       </android.support.design.widget.TextInputLayout>
Это стиль:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>
<!-- Application theme. -->
 <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
        <item name="colorAccent">@color/pink</item>
        <item name="colorControlNormal">@color/purple</item>
        <item name="colorControlActivated">@color/yellow</item>
    </style>
Вы должны использовать свою тему в приложении:
<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
</application>
чтобы изменить цвет текстовой метки, когда вы фокусируетесь на ней. т.е. вводить в нее. вам нужно добавить опцию
<item name="android:textColorPrimary">@color/yourcolorhere</item>
Просто примечание: Вы должны добавить все эти реализации в свою основную тему.
Его работа для меня..... добавить цвет подсказки в TextInputLayout
    <android.support.design.widget.TextInputLayout
        android:textColorHint="#ffffff"
        android:id="@+id/input_layout_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <EditText
            android:id="@+id/edtTextPassword"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp"
            android:hint="Password"
            android:inputType="textPassword"
            android:singleLine="true"
            />
    </android.support.design.widget.TextInputLayout>
Я пытался использовать android: textColorHint в android.support.design.widget.TextInputLayout, он работает нормально.
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@color/colorAccent">
            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Hello"
                android:imeActionLabel="Hello"
                android:imeOptions="actionUnspecified"
                android:maxLines="1"
                android:singleLine="true"/>
        </android.support.design.widget.TextInputLayout>
  <style name="AppTheme2" parent="AppTheme">
    <!-- Customize your theme here. -->
    <item name="colorControlNormal">#fff</item>
    <item name="colorControlActivated">#fff</item></style>    
добавьте это к стилям и установите TextInputLayout Theam в App2, и это будет работать;)
<com.google.android.material.textfield.TextInputLayout
    android:hint="Hint"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/TextInputLayoutHint">
    <androidx.appcompat.widget.AppCompatEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:maxLines="1"
        android:paddingTop="@dimen/_5sdp"
        android:paddingBottom="@dimen/_5sdp"
        android:textColor="#000000"
        android:textColorHint="#959aa6" />
</com.google.android.material.textfield.TextInputLayout>
RES/значения /styles.xml
<style name="TextInputLayoutHint" parent="">
    <item name="android:textColorHint">#545454</item>
    <item name="colorControlActivated">#2dbc99</item>
    <item name="android:textSize">11sp</item>
</style>