有两种解决方法:
(1)对位于底层的窗口赋以如下style:
<style name="not_dim" >
<item name="android:backgroundDimEnabled">false</item>
</style>
意思即为不让背景变暗。
(2)通过代码修改Dialog的属性:
WindowManager.LayoutParams layoutParams = myDialog.getWindow().getAttributes();
layoutParams.dimAmount = 0F;
myDialog.this.getWindow().setAttributes(layoutParams);
注意。。。以上代码是没有用的,因为Dialog默认添加了“WindowManager.LayoutParams.FLAG_DIM_BEHIND”,该标记的作用是使位于该窗口下的界面变暗,
因此,
myDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND):
解决问题。