如何更改颜色的Android对话的背后 [英] How to Change the Color Behind Android Dialog
问题描述
我想改变暗淡的背景下,围绕着Android的对话框(而不是窗口的背景绘制)编程的颜色。我使用的是对话的主题活动。我不想有啥用呢,也不知道怎么回事了。
I would like to change the color of the dimmed background that surrounds an Android dialog (not the Window background drawable) programmatically. I am using a dialog themed activity. I do not want to dim it, nor blur it.
如果你想像一个对话框,三个按钮,我想有它做这样的事情:
If you imagine a dialog with three buttons, I would like to have it do something like this:
- 点击答:背景半透明红色
- 单击B:背景半透明黄色
- 单击C:背景,半透明的绿色
推荐答案
我不知道,你可以改变背景颜色。调光由 dimAmount 控制code>的对话窗口的布局
的字段(以及<一个href="http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_DIM_BEHIND"相对=nofollow> FLAG_DIM_BEHIND
标志)。 dimAmount
仅仅是0.0和1.0控制调光量(透明到完全不透明)之间的浮动。我认为这是现有的背景只是一个alpha混合;有没有控制,据我已经能够找到着色。
I'm not sure you can change the color of the background. The dimming is controlled by the dimAmount
field of the layout for the dialog window (as well as the FLAG_DIM_BEHIND
flag). dimAmount
is just a float between 0.0 and 1.0 that controls the amount of dimming (transparent to totally opaque). I think it's just an alpha blend of the existing background; there's no control of coloring as far as I've been able to find.
这篇关于如何更改颜色的Android对话的背后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!