1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//获取屏幕的长度和宽度
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int heigh = dm.heightPixels;
Dialog d = new Dialog( this );
d.setTitle(width + "*" + heigh);
d.show();
}
|