setFinishOnTouchOutside(true);
WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay(); // 为获取屏幕宽、高
android.view.WindowManager.LayoutParams p = getWindow().getAttributes();
p.height = (int) (d.getHeight() * 1.0); // 高度设置为屏幕的0.3
p.width = (int) (d.getWidth() * 0.8); // 宽度设置为屏幕的0.7
getWindow().setAttributes(p);
getWindow().setWindowAnimations(R.style.mystyle);//动画
p.gravity = Gravity.RIGHT;//设置对话框置顶显示
WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay(); // 为获取屏幕宽、高
android.view.WindowManager.LayoutParams p = getWindow().getAttributes();
p.height = (int) (d.getHeight() * 1.0); // 高度设置为屏幕的0.3
p.width = (int) (d.getWidth() * 0.8); // 宽度设置为屏幕的0.7
getWindow().setAttributes(p);
getWindow().setWindowAnimations(R.style.mystyle);//动画
p.gravity = Gravity.RIGHT;//设置对话框置顶显示