1 private void setWinWidth() {2 DisplayMetrics metric = new DisplayMetrics();3 getWindowManager().getDefaultDisplay().getMetrics(metric);4 LayoutParams p = getWindow().getAttributes();5 p.width = (int) (metric.widthPixels * 0.8);6 getWindow().setAttributes(p);7 }