从 AutoCompleteTextView 中删除下拉箭头

8 android autocompletetextview android-textinputlayout material-components material-components-android

我想删除AutoCompleteTextView在我使用TextInputLayout和使用样式时创建的下拉箭头:ExposedDropdownMenu

添加了有关我要删除的内容的图片

下面是我的代码:

<com.google.android.material.textfield.TextInputLayout
        android:layout_marginTop="10dp"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
        android:hint="Marital Status"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:boxStrokeColor="@color/colorPrimaryDark">

        <AutoCompleteTextView
            android:background="@null"
            android:focusable="false"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/edt_marital" />
    </com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

Gab*_*tti 22

如果您想避免使用下拉图标,只需使用该app:endIconMode属性。

<com.google.android.material.textfield.TextInputLayout
      style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
      app:endIconMode="none"
      ...>
Run Code Online (Sandbox Code Playgroud)

之前和之后:

在此处输入图片说明在此处输入图片说明

  • 设置 app:endIconMode="none" 后,下拉菜单不显示 (5认同)