我试图创建一个AutoCompleteTextView,被一个包围TextInputLayout。根据文档,我应该使用这种风格:
Widget.MaterialComponents.TextInputLayout.*.ExposedDropdownMenu
但我无法解决这种风格。Android Studio 说我只能使用:
@style/Widget.MaterialComponents.TextInputLayout.FilledBox.Dense
@style/Widget.MaterialComponents.TextInputLayout.FilledBox
@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense
@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox
我的项目使用
implementation 'com.android.support:design:28.0.0'
最终结果应如下所示:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_text">
<AutoCompleteTextView
android:id="@+id/filled_exposed_dropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>