我可以获取弹出窗口,但背景是透明的,我也可以读取其背后活动的内容。我想调暗背景,以使弹出窗口和较旧的活动区分开。
您可以
通过2种方式做到这一点:1.通过将具有透明度的背景色添加到弹出式布局的父级。例:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cc000000">
<YOUR_POPUP_VIEW
.... />
</RelativeLayout>
WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.dimAmount = #WHAT_EVER_VALUE_YOU_WANT_TO_KEEP; //Generally in between 0.70f to 0.80f getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); getWindow().setAttributes(layoutParams);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句