"inputType =" none"不适用于材料组件ExposedDropdownMenu [英] "inputType="none" doesn't work with Material Components ExposedDropdownMenu
问题描述
我正在尝试按照此处的实施公开的下拉菜单"下的指南制作一个不可编辑的公开的下拉菜单: https://material.io/develop/android/components/text-fields/
I'm trying do make a non-editable exposed dropdown menu, following the guide under "Implementing an exposed dropdown menu" found here: https://material.io/develop/android/components/text-fields/
但是,即使在AutoCompleteTextView上使用"inputType =" none",它仍然可以编辑.
However, it's still editable, even with "inputType="none"" on the AutoCompleteTextView.
这是我的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>
有人知道为什么它不起作用,即使它在他们的官方文档中,以及如何使它真正不可编辑?
Does anybody know why this doesn't work, even though it's in their official documentation and how to make this truly non-editable?
PS:"editable =" false"确实解决了问题,但是由于不切实际,我真的不想使用它
PS: "editable="false"" does solve the problem, but since this is depracted, I don't really want to use it
推荐答案
这是怎么回事:
android:focusable="false"
android:focusableInTouchMode="false"
android:inputType="none|textNoSuggestions"
android:cursorVisible="false"
这篇关于"inputType =" none"不适用于材料组件ExposedDropdownMenu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!