![](/img/trans.png)
[英]AutoCompleteTextView - How to remove margin from top and bottom?
[英]Remove top and bottom black borders from AutoCompleteTextView
我遇到了 AutoCompleteTextView 下拉組件的問題。
從下圖中可以看出,彈出窗口中有一些我無法擺脫的黑色邊框。
黑色邊框:
我是一個 Android 菜鳥,我基本上已經嘗試了一切並取得了成功。
在代碼下方,我正在使用。
活動.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"/>
你能幫我么? 十分感謝!
這個黑線是來自PopupBackgroundView
的附加背景。 要解決此問題,只需使用與主題中相同的surfaceColor
作為背景
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
...
<item name="colorSurface">#FFFFFF</item>
</style>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.