一个popwindow,在弹出的时候背景是原界面的截图加高斯模糊效果:
先给出popwindow的布局文件
& lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比; & lt; FrameLayout xmlns: android=" http://schemas.android.com/apk/res/android " android: id=癅 + id/FrameLayout1” android: layout_width=" match_parent " android: layout_height=" match_parent " android:背景=癅drawable/roundcorner”比; & lt; com.npi.blureffect.ScrollableImageView android: id=癅 + id/imageView1” android:背景=" @drawable/roundcorner” android: layout_width=" match_parent " android: layout_height=" match_parent " android: src=" https://www.yisu.com/zixun/@drawable roundcorner "/比; & lt;使用 android: id=癅 + id/RelativeLayout1” android: layout_width=" match_parent " android: layout_height=癿atch_parent”比; & lt; TextView android: id=癅 + id/textView1” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_alignParentLeft=" false " android: layout_alignParentTop=" false " android: layout_centerHorizontal=" true " android: layout_centerInParent=" false " android: layout_centerVertical=" false " android: layout_marginLeft=" 33 dp " android: layout_marginTop=" 44 dp " android:文本="这是提示语”/比; & lt; TextView android: id=癅 + id/textView2” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_alignParentLeft=" false " android: layout_below=癅 + id/textView1” android: layout_centerHorizontal=" true " android: layout_marginTop=" 49 dp " android:文本="确定” android: textAppearance=" & # 63; android: attr/textAppearanceLarge”/比; & lt;/RelativeLayout> & lt;/FrameLayout> >之前里面那个自定义imageView控件在我上一篇博客里、下面是活动的布局
& lt; RelativeLayout xmlns: android=" http://schemas.android.com/apk/res/android " xmlns:工具=" http://schemas.android.com/tools " android: id=癅 + id/窗口” android: layout_width=" match_parent " android: layout_height=" match_parent " android: paddingBottom=" @dimen/activity_vertical_margin” android: paddingLeft=" @dimen/activity_horizontal_margin” android: paddingRight=" @dimen/activity_horizontal_margin” android: paddingTop=" @dimen/activity_vertical_margin” 工具:上下文=" com.npi.blureffect。祝辞TestActivity”; & lt; TextView android: id=癅 + id/textView1” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android:文本=癅string/hello_world”/比; & lt; RatingBar android: id=癅 + id/ratingBar1” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_alignLeft=癅 + id/textView1” android: layout_below=癅 + id/textView1” android: layout_marginTop=" 124 dp/比; & lt;开关 android: id=癅 + id/switch2” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_alignLeft=癅 + id/ratingBar1” android: layout_below=癅 + id/ratingBar1” android: layout_marginLeft=" 24 dp " android: layout_marginTop=" 81 dp” android:文本="开关"/比; & lt;按钮 android: id=癅 + id/button1” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_alignRight=癅 + id/ratingBar1” android: layout_below=癅 + id/ratingBar1” android:文本=鞍磁ァ?比; & lt;按钮 android: id=癅 + id/button2” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_alignBottom=癅 + id/ratingBar1” android: layout_alignLeft=癅 + id/switch2” android: layout_marginBottom=" 52 dp " android:文本=鞍磁ァ?比; & lt; TextView android: id=癅 + id/textView2” android: layout_width=" wrap_content " android: layout_height=" wrap_content " android: layout_alignBottom=癅 + id/button1” android: layout_alignLeft=癅 + id/ratingBar1” android:文本="大型文本" android: textAppearance=" & # 63; android: attr/textAppearanceLarge”/比; & lt;/RelativeLayout>Android实现毛玻璃效果的对话框