Changing Spinner background generates dark colored border

↘锁芯ラ 提交于 2021-01-28 04:21:22

问题


Using a simple spinner. When I scroll the spinner the shadow around spinner dropdown starts growing darker in color.

I managed to fix the issue but

I will appreciate if someone could explain me why was this happening?

<Spinner
            android:id="@id/drop_list_1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:background="@android:color/transparent"
            android:dropDownSelector="@android:drawable/list_selector_background"
            android:dropDownWidth="wrap_content"
            android:minHeight="@dimen/min_header_height"
            android:popupBackground="#FFFFFF" />


回答1:


fixed: for Api below 21

style="@style/Widget.AppCompat.Spinner.DropDown"

if working on api 21 and above

android:popupTheme="@style/Widget.AppCompat.Spinner.DropDown"



回答2:


As of July 2016, the shadowing issue is still present when android:popupBackground is used to specify a color (eg: White)

Google has provided a fix for this for Android 6.0 and above via android:popupTheme but that is not applicable for < 6.0

Detailed explanation : How do I set a different theme for a Spinner's dropdown?

Working Solution (Android < 6.0) - Creating a shape and using it as background : Spinner graphical bug API 21



来源:https://stackoverflow.com/questions/35721120/changing-spinner-background-generates-dark-colored-border

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!