"inputType="none" 不适用于 Material 组件 ExposedDropdownMenu
"inputType="none" doesn't work with Material Components ExposedDropdownMenu
我正在尝试制作一个不可编辑的公开下拉菜单,按照此处 "Implementing an exposed dropdown menu" 下的指南:https://material.io/develop/android/components/text-fields/
但是,即使在 AutoCompleteTextView 上使用 "inputType="none"",它仍然是可编辑的。
这是我的 xml:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none" />
</com.google.android.material.textfield.TextInputLayout>
有谁知道为什么这不起作用,即使它在他们的官方文档中以及如何使它真正不可编辑?
PS: "editable="false"" 确实解决了这个问题,但是因为这个很不实用,所以我真的不想用它
这个怎么样:
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="none|textNoSuggestions"
android:cursorVisible="false"
我正在尝试制作一个不可编辑的公开下拉菜单,按照此处 "Implementing an exposed dropdown menu" 下的指南:https://material.io/develop/android/components/text-fields/
但是,即使在 AutoCompleteTextView 上使用 "inputType="none"",它仍然是可编辑的。
这是我的 xml:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none" />
</com.google.android.material.textfield.TextInputLayout>
有谁知道为什么这不起作用,即使它在他们的官方文档中以及如何使它真正不可编辑?
PS: "editable="false"" 确实解决了这个问题,但是因为这个很不实用,所以我真的不想用它
这个怎么样:
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="none|textNoSuggestions"
android:cursorVisible="false"