简体   繁体   中英

Remove top and bottom black borders from AutoCompleteTextView

I'm experiencing a problem with the AutoCompleteTextView dropdown component.

As you can see from the image below, there are those black borders inside the popup that I cannot get rid of.

Black borders:

后边框

I'm an Android noob, and I already tried basically everything with any success.

Below the code, I'm using.

activity.xml:

<com.google.android.material.textfield.TextInputLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="3"
                        android:hint="Categoria"
                        android:layout_marginRight="@dimen/spacing_xlarge"
                        app:hintEnabled="true"
                        app:boxBackgroundColor="@color/white"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">

                    <AutoCompleteTextView
                            android:dropDownSelector="@color/white"
                            android:id="@+id/private_place_dropdown"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:dropDownHeight="300dp"
                            android:inputType="none"
                            android:drawableTint="@color/white"
                            android:backgroundTint="@color/white"
                            android:editable="false"
                            android:textColor="@color/piumaBaseColor"
                            />

                </com.google.android.material.textfield.TextInputLayout>

dropdown_menu_popup_item.xml:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:paddingLeft="@dimen/spacing_medium"
    android:paddingRight="@dimen/spacing_medium"
    android:paddingBottom="@dimen/spacing_medium"
    android:ellipsize="end"
    android:maxLines="1"
    android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
    android:gravity="center_vertical"
    android:background="@color/white"
    android:backgroundTint="@color/white"
    android:textColor="@color/grey_extradark"
    android:text="test"/>

Can you please help me? Thank you a lot!

This dark lined are additional background from PopupBackgroundView . For fix the issue just use for background the same surfaceColor as you have in your theme

<style name="AppTheme" parent="Theme.MaterialComponents.Light">
    ...
    <item name="colorSurface">#FFFFFF</item>
</style>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM