经过测试,可以使用.
-----------------------------------------------------------
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog dialog = builder.create(); int screenWidth_px = PX_DP_utils.getScreenWidth_PX(this); int screenHeight_px = PX_DP_utils.getScreenheight_PX(this); dialog.show(); //需要设置属性,否则dialog的大小不起作用!必须先show再set属性 WindowManager.LayoutParams params = dialog.getWindow().getAttributes(); params.width = (int) (screenWidth_px * 0.7 + 0.5f); params.height = (int) (0.6 * screenHeight_px + 0.5f); // 必须使用这个方法,不能使用dialog.setView()的方法 dialog.getWindow().setContentView(R.layout.dialog_picpick_three); //设置dialog的背景颜色为透明色,就可以显示圆角了!! dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.getWindow().setAttributes(params);
原文:http://www.cnblogs.com/tinyclear/p/6244007.html