方向改变时如何改变android中Dialog的尺寸。
onCreate 中的代码
static final float[] DIMENSIONS_DIFF_LANDSCAPE = {20, 60};
static final float[] DIMENSIONS_DIFF_PORTRAIT = {40, 60};
final float scale = getContext().getResources().getDisplayMetrics().density;
int orientation = getContext().getResources().getConfiguration().orientation;
float[] dimensions =
(orientation == Configuration.ORIENTATION_LANDSCAPE)
? DIMENSIONS_DIFF_LANDSCAPE : DIMENSIONS_DIFF_PORTRAIT;
addContentView(mContent, new LinearLayout.LayoutParams(
display.getWidth() - ((int) (dimensions[0] * scale + 0.5f)),
display.getHeight() - ((int) (dimensions[1] * scale + 0.5f))));
我想在方向改变时做同样的事情。请帮忙