Android spinner dropdown menu background color change
Asked Answered
P

3

23

I want to change a spinner's dropdown menu background color without changing the background color of the spinner itself (it's transparent). Is it possible?

Priorate answered 23/3, 2015 at 19:12 Comment(0)
G
73

Yep, it's possible. Use android:popupBackground on the Spinner in your XML or setPopupBackgroundResource(int) in code.

Glisten answered 23/3, 2015 at 19:18 Comment(0)
M
5

To change the background color of the drop-down list, add android:colorBackground parameter to the theme in your styles.xml

Code:

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="android:colorBackground">#ff0000</item>
</style>

Thus, the overall style is preserved: the effect when pressed, rounded corners, etc.

Screenshot:

enter image description here enter image description here

Making answered 12/5, 2020 at 10:56 Comment(0)
R
0

When using Material Design 3 responsible attribute is:

    <item name="colorSurface">@color/foo</item>
Roundhouse answered 16/6, 2022 at 22:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.