【发布时间】:2019-02-03 03:53:01
【问题描述】:
我正在尝试更改 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>
笔触颜色,hintTextAppearence,提示颜色和通过切换色调颜色改变但其他人没有,我想要的是改变边框的颜色,当它不集中怎么做?请帮助并提前感谢
【问题讨论】:
-
目前我找到的最佳答案是这个 --> stackoverflow.com/a/50818399/1177959
-
@Sotti 谢谢,这很有帮助,但如果我想在某些页面中更改它,该怎么做?
-
鉴于一切都非常hacky,我不知道该怎么做。我对 TextInputLayout 缺乏基本自定义感到非常惊讶。
标签: android colors styles android-textinputlayout