Android 提示/标签概述的TextInputLayout的背景色
我正在尝试使用OutlinedBox包装TextInputItemText来设置TextInputLayout的样式。我已经能够根据状态设置边框框颜色和提示文本颜色属性,但我无法将白色背景应用于框内的区域。很多问题都与提示文本颜色有关,只有少数报告了这种行为,但没有适当的解决方案。 这份报告提出了同样的问题,但正如答案中指出的那样,似乎没有解决办法 无论如何,正如您所看到的,通过将背景应用于内部TextInputText,提示/标签实际上起到了预期的作用,但是TextInputLayout失去了圆角边框。因此,必须有一种方法将“透明”背景应用于提示,对吗 布局(……只是id和约束属性)Android 提示/标签概述的TextInputLayout的背景色,android,material-design,android-xml,Android,Material Design,Android Xml,我正在尝试使用OutlinedBox包装TextInputItemText来设置TextInputLayout的样式。我已经能够根据状态设置边框框颜色和提示文本颜色属性,但我无法将白色背景应用于框内的区域。很多问题都与提示文本颜色有关,只有少数报告了这种行为,但没有适当的解决方案。 这份报告提出了同样的问题,但正如答案中指出的那样,似乎没有解决办法 无论如何,正如您所看到的,通过将背景应用于内部TextInputText,提示/标签实际上起到了预期的作用,但是TextInputLayout失去了
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
....
<com.google.android.material.textfield.TextInputLayout
style="@style/LoginTextInputLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
... >
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="18sp"/>
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<style name="LoginTextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="android:textColorHint">@color/colorAccent</item>
<item name="hintTextColor">@color/colorAccent</item>
<item name="boxStrokeColor">@color/text_input_layout_login_selector</item>
<item name="boxStrokeWidthFocused">1dp</item>
</style>