这个改变是基于 用户研究 并在版本中引入了 1.1.0 材料设计库的安卓版 (MDC). 如果你想要传统的外观和感觉,官方文档推荐了这个方法。
修改一个文本字段。
<com.google.android.material.textfield.TextInputLayout
...
style="@style/Widget.Design.TextInputLayout">
...
</com.google.android.material.textfield.TextInputLayout>
更改主题中的所有文本字段。
<style name="Theme.MyApp" parent="Theme.MaterialComponents.*">
...
<item name="textInputStyle">@style/Widget.MyApp.TextInputLayout</item>
</style>
<style name="Widget.MyApp.TextInputLayout" parent="Widget.Design.TextInputLayout">
<!-- My custom attrs -->
</style>