安卓:使周围的一切对话比默认暗 [英] Android: make everything around Dialog darker than default

查看:146
本文介绍了安卓:使周围的一切对话比默认暗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的风格的自定义对话框:

i have a custom dialog with following style:

<style name="webtogo_app_style"  parent="@android:style/Theme.Dialog">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
</style>

它显示了一个无国界的对话,而且什么都落后得(略)暗。我的设计人员希望这一切的背后得到了比以往任何时候都Android的默认比较暗,但不会完全变黑。

It shows a borderless dialog, and anything behind gets (slightly) darker. My designer wants that everything behind got ever more dark than Android's default, but not completely black.

是否有这在所有的设置?

Is there a setting for this at all?

唯一的解决办法我能想到的就是使用全屏的活动,而不是一个对话框,只是填满整个屏幕,半透明的颜色(如#99000000),然后画出我的对话权。有没有更简单的方法?

The only workaround I can think of is to use a full-screen activity instead of a dialog and just fill up the whole screen with semitransparent color (e.g. #99000000) and then draw my dialog over it. Is there an easier way?

谢谢!

推荐答案

所有你需要做的就是玩弄于 dimAmount 字段 WindowManager.LayoutParams

All you need to do is play around with the dimAmount field in the WindowManager.LayoutParams:

WindowManager.LayoutParams lp = myDialog.getWindow().getAttributes();
lp.dimAmount = 0.7f

这篇关于安卓:使周围的一切对话比默认暗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆