简体   繁体   中英

How to change a Dialog's background overlay color

I want to change the overlay color of a dialog. The first which comes as transparent gray.

I tried:

<item name="android:windowContentOverlay">@color/customColor</item>
<item name="android:colorBackgroundCacheHint">@color/customColor</item>

They did not work. When I tried:

<item name="android:windowBackground">@color/customColor</item>

The content background is changing.

I found a one rule solution!

d.getWindow().setBackgroundDrawableResource(R.drawable.menubackground);

It works for me with a normal dialog. But I dont know if it works on an AlertDialog .

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