Android 开发_当前界面弹出图片 dialog,
以往我们查看图片时, 通常是在意个新的 activity 中打开图片, 现在很多主流 APP 中可以直接在当前界面弹出图片, 让用户体验很清爽. 其实我们可以通过 dialog 的形式对图片进行展示。代码其实很简单.
- R.style.edit_AlertDialog_style);
- dialog.setContentView(R.layout.activity_start_dialog);
- ImageView imageView = (ImageView) dialog.findViewById(R.id.iv_show);
- imageView.setBackgroundResource(R.drawable.icon_record_play);
- dialog.show();
- dialog.setCanceledOnTouchOutside(true); //点击可以退出Window window = dialog.getWindow();WindowManager.LayoutParams attributes = window.getAttributes();attributes.x = 0;attributes.y = 40;dialog.onWindowAttributesChanged(attributes);
就爱阅读 www.92to.com 网友整理上传, 为您提供最全的知识大全, 期待您的分享,转载请注明出处。
来源: http://www.92to.com/bangong/2017/03-22/19258484.html