Android 文本输入布局样式

Android 文本输入布局样式,android,material-design,android-textinputlayout,material-components-android,Android,Material Design,Android Textinputlayout,Material Components Android,我的自定义TextInputLayout有问题。这是我的密码 <com.google.android.material.textfield.TextInputLayout android:id="@+id/phone" android:layout_width="0dp" android:layout_height="wrap_content" android:theme="@style/CustomTextInputLayout" android:

我的自定义
TextInputLayout
有问题。这是我的密码

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/phone"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:theme="@style/CustomTextInputLayout"
    android:hint="@string/phone_number"
    android:layout_marginTop="8dp"
    android:layout_marginStart="16dp"
    android:layout_marginEnd="16dp"
    app:startIconDrawable="@drawable/account"
    android:background="@color/bg_light_gray"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/page_description">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="?attr/listPreferredItemHeight"
        android:background="@color/bg_light_gray"
        android:inputType="phone"
        android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
我想将
TextInputLayout
的基线颜色设置为橙色,但现在是灰色。另外,我放置了一个图标,它的原始颜色是橙色,但放置后它变成了深灰色。现在我不明白为什么会发生这种情况,以及如何解决这个问题。有人能帮我吗

我想将TextInputLayout的基线颜色设置为橙色

只需使用
app:boxStrokeColor
属性(例如
Widget.MaterialComponents.TextInputLayout.FilledBox
)即可更改颜色

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/custom_end_icon"
    style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
    app:boxStrokeColor="@color/text_input_selector

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/custom_end_icon"
    style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
    app:boxStrokeColor="@color/text_input_selector
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:color="?attr/colorPrimary" android:state_focused="true"/>
  <item android:alpha="0.87" android:color="?attr/colorOnSurface" android:state_hovered="true"/>
  <item android:alpha="0.12" android:color="?attr/colorOnSurface" android:state_enabled="false"/>
  <item android:alpha="0.38" android:color="?attr/colorAccent"/>
</selector>
<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/custom_end_icon"
    android:hint="Hint text"
    style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
    app:boxStrokeColor="@color/text_input_selector"
    app:endIconMode="custom"
    app:endIconDrawable="@drawable/ic_add_24px"
    app:endIconTint="@color/text_input_selector"