在代码中对窗体设置透明度灰度的方法

来源:互联网 发布:excel2016数据有效性 编辑:程序博客网 时间:2024/06/05 07:18

设置透明度(这是窗体本身的透明度,非背景)

        WindowManager.LayoutParams windowLP = getWindow().getAttributes();        windowLP.alpha = 0.5f;        getWindow().setAttributes(windowLP);

设置灰度(背景灰度)

        WindowManager.LayoutParams windowLPs = getWindow().getAttributes();        windowLP.dimAmount = 1.0f;        getWindow().setAttributes(windowLP);        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
原创粉丝点击