我想改变屏幕的亮度,除了我希望显示listView的一小部分。
这是针对Android的DialogInterface,我想知道如何做到这一点。 在DialogInterface中,对话框具有正常亮度,所有其他元素在背景上以较小的亮度进行。
谢谢。
答案 0 :(得分:5)
要将对话框的背景设置为暗淡,以下是代码段:
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
/** set the dim amount of the settings activity */
lp.dimAmount = 0.5f;
dialog.getWindow().setAttributes(lp);
答案 1 :(得分:1)
假设您有listview所在的ShowDialogActivity。然后您可以在 manifest.xml中执行此操作:
...
<application android:label="@string/app_name">
...
<activity android:name=".ShowDialogActivity" android:theme="@style/Dialog"/>
</application>
...