简体   繁体   中英

How to set spinner popup background color dynamically with hex code?

When I try to set spinner popup background, following code works;

setPopupBackgroundResource(R.drawable.black);

But I need to set hex code dynamically as popup background and uses following code.But it doesn't work for me

spinner.setPopupBackgroundResource(#FF5733)

Thanks in advance...:)

You want to use setPopupBackgroundDrawable() like this:

spinner.setPopupBackgroundDrawable(ColorDrawable(0xFF5733));

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