您的位置:首页 > 其它

如何实现透明遮挡层显示图片

2017-08-28 14:50 302 查看

实现透明遮挡层显示图片(效果如下)

实现这种效果

过程如下:

Context context = ManualActivity.this;
Dialog dia = new Dialog(context, R.style.edit_AlertDialog_style);
dia.setContentView(R.layout.activity_start_dialog);
ImageView imageView = (ImageView) dia.findViewById(R.id.img_manual_example);
imageView.setBackgroundResource(R.drawable.manual_idcard);
dia.show();
dia.setCanceledOnTouchOutside(true); // Sets whether this dialog is
Window w = dia.getWindow();

WindowManager.LayoutParams lp = w.getAttributes();
lp.x = 0;
lp.y = 40;
dia.onWindowAttributesChanged(lp);

通过Dialog就可以实现这种效果
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: