我正在尝试更改textInputLayout的轮廓或边框颜色,但不知道为什么它没有改变。我搜索并找到了一些解决方案,但对我没有用。
这里我放置了样式,然后将其应用于textInputLayout。
<style name="WhiteOutlineBox" parent="Widget.MaterialComponents.TextInputLayout.OutlineBox">
<item name="boxStrokeColor">@color/snow </item>
<item name="hintTextAppearance">@style/TextLabel</item>
<item name="android:textColorHint">@color/snow</item>
<item name="passwordToggleTint">@color/snow</item>
<item name="colorControlNormal">@color/snow</item>
<item name="colorControlActivated">@color/snow</item>
<item name="colorControlHighlight">@color/snow</item>
<item name="colorPrimary">@color/snow</item>
<item name="colorPrimaryDark">@color/snow</item>
<item name="colorAccent">@color/snow</item>
</style>
<!-- this style for the hint text lable in textInputLayout -->
<style name="TextLabel" parent="TextAppearance.Design.Hint">
<item name="android:textSize">12sp</item>
<item name="android:textColor">@color/snow</item>
</style>
这里是在xml中将其应用于textInputLayout的代码
<android.support.design.widget.TextInputLayout
android:id="@+id/ed_oldPass"
style="@style/WhiteOutlineBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginTop="50dp"
app:passwordToggleEnabled="true">
<android.support.design.widget.TextInputEditText
style="@style/WhiteOutlineBox"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/snow"
android:textColor="@color/snow"
android:layout_marginBottom="10dp"
android:hint="@string/old_pass_ed_hint"
android:inputType="textPassword"
android:paddingEnd="10dp"
android:paddingStart="10dp" />
</android.support.design.widget.TextInputLayout>
边框颜色、提示文本外观、提示文本颜色和密码切换色已更改,但其他内容未更改,我想要的是在没有焦点时更改边框颜色,该如何实现?请帮忙,谢谢。