Dialog的圆角,和偏移量(新手推荐)

AlertDialog.Builder builder = new AlertDialog.Builder(上下文);
AlertDialog dialog = builder.create();
dialog.show();
dialog.setCanceledOnTouchOutside(true);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//用来显示自定义的圆角类型,或者相对于屏幕所显示的位置,重要
dialog.getWindow().setContentView(布局);
dialog.getWindow().setGravity(显示位置);

你可能感兴趣的:(Dialog)