摘要:Android - 取得螢幕解析度及動態調整layout大小
// 取得螢幕解析度
DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
int vWidth = dm.widthPixels;
int vHeight = dm.heightPixels;
LinearLayout ll = (LinearLayout)dialog.findViewById(R.id.lldialog);
ll.getLayoutParams().width=(int)(vWidth*0.9);