【发布时间】:2019-04-22 15:45:30
【问题描述】:
我正在登录屏幕上,我想用以下视图实现材料编辑文本:
以下是我的代码:
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
style="@style/ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="This is Hint"/>
</com.google.android.material.textfield.TextInputLayout>
但 OutlinedBox 没有出现。看起来是这样的:
请帮忙。
【问题讨论】:
-
使用
TextInputLayout的主题,而不是TextInputEditText的主题。你使用了错误的风格。使用这个style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" -
这并不能解决 Material 1.2.x 库中的问题。相关的 GitHub 问题在这里:github.com/material-components/material-components-android/…
标签: android android-edittext material-design android-textinputlayout androidx