Android:View。无法使用ExposedDropdownMenu中的AutoCompleteTextview
我有一个Android:View。无法使用ExposedDropdownMenu中的AutoCompleteTextview,android,kotlin,autocompletetextview,material-components-android,android-textinputlayout,Android,Kotlin,Autocompletetextview,Material Components Android,Android Textinputlayout,我有一个ExposedDropDownMenu,作为Material.IO推荐的微调器。我的问题是,View.Gone不起作用,在视图中留下一个箭头,因此仍然占用空间 截图 XML 谢谢你的帮助。谢谢大家! 能否尝试隐藏TextInputLayout而不是包含的AutoCompleteTextView。为外部TextInputLayout添加一个id,如下所示: <com.google.android.material.textfield.TextInputLayout styl
ExposedDropDownMenu
,作为Material.IO推荐的微调器。我的问题是,View.Gone
不起作用,在视图中留下一个箭头,因此仍然占用空间
截图
XML
谢谢你的帮助。谢谢大家! 能否尝试隐藏TextInputLayout而不是包含的AutoCompleteTextView。为外部TextInputLayout添加一个id,如下所示:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
android:id="@+id/dropdown_layout"
android:layout_width="0dp"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/calibrate_message_dropdown_menu_TWO"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
tools:ignore="LabelFor" />
</com.google.android.material.textfield.TextInputLayout>
如果要删除下拉图标,只需使用:
textInputLayout.endIconMode = TextInputLayout.END_ICON_NONE
哦,哇,这确实奏效了。我很惊讶,因为我以前确实试过,但没有。非常感谢。不,我想删除整个布局,而不仅仅是箭头。
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
android:id="@+id/dropdown_layout"
android:layout_width="0dp"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/calibrate_message_dropdown_menu_TWO"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
tools:ignore="LabelFor" />
</com.google.android.material.textfield.TextInputLayout>
dropdown_layout.visibility = View.GONE
textInputLayout.endIconMode = TextInputLayout.END_ICON_NONE