Android(安卓)如何设置自定义dialog的大小
16lz
2021-12-22
final View inflate = LayoutInflater.from(StationManagementActivity.this).inflate(R.layout.qrcode, null);final LinearLayout ll_dialog_id = (LinearLayout) inflate.findViewById(R.id.dialog_id);ImageView qrcode = (ImageView) inflate.findViewById(R.id.iv_qrcode);final ImageView guanbi = (ImageView) inflate.findViewById(R.id.iv_guanbi);final Dialog dialog = new AlertDialog .Builder(StationManagementActivity.this) .setView(inflate) .show();final WindowManager.LayoutParams params = dialog.getWindow().getAttributes();params.width = 800;params.height = 1200;dialog.getWindow().setAttributes(params);dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);Glide.with(StationManagementActivity.this).load(list.get(position).getDwhat()).into(qrcode);Animation animation = AnimationUtils.loadAnimation(StationManagementActivity.this, R.anim.scale);inflate.setAnimation(animation);animation.start();
本篇博客不但设置了dialog大小,还添加了缩放动画。 设置dialog大小关键代码:
更多相关文章
- Android自定义对话框(Dialog)位置,大小
- android实现发送短信demo
- Android(安卓)设置dialog在底部显示
- Android文件下载进度条的实现
- android的动画实例
- Android(安卓)Camera照相机
- Android(安卓)有入场动画的Popuwindow
- TextView 设置 Ellipsize 属性,但它不工作?
- Android之视频播放2