android - "inputType="none" 不适用于材质组件 ExposedDropdownMenu
问题描述
我正在尝试按照此处找到的“实施公开的下拉菜单”下的指南制作一个不可编辑的公开下拉菜单: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"
推荐阅读
- laravel - Google Authentification Laravel Socialite 在询问“个人资料”范围时给出 403 错误
- html - 响应式视口中的引导工具提示定位出乎意料
- python - 函数变量的变量命名约定
- apache-camel - 作为 AggregationDefinition 的一部分,groupExchanges() 方法是否仍然存在于 apache Camel 中?
- r - ggplot 中的列数与闪亮输入不同
- flutter - 无法访问没有内容类型的请求的正文字段 - Flutter
- angular - TinyMCE 中的 images_upload_handler 不适用于 Angular 8
- python-3.x - 如何优化代码?和平方差代码?
- c++ - C++ Eigen 将单元素数组视为算术运算的标量
- python - 如何在 Django 中解决无反向匹配问题