[英]Remove top and bottom black borders from AutoCompleteTextView
I'm experiencing a problem with the AutoCompleteTextView dropdown component.我遇到了 AutoCompleteTextView 下拉组件的问题。
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.我是一个 Android 菜鸟,我基本上已经尝试了一切并取得了成功。
Below the code, I'm using.在代码下方,我正在使用。
activity.xml:活动.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: 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
.这个黑线是来自
PopupBackgroundView
的附加背景。 For fix the issue just use for background the same surfaceColor
as you have in your theme要解决此问题,只需使用与主题中相同的
surfaceColor
作为背景
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
...
<item name="colorSurface">#FFFFFF</item>
</style>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.