首页 > 试题广场 >

在安卓应用程序开发中,可以通过( )获得屏幕的属性

[单选题]
在安卓应用程序开发中,可以通过( )获得屏幕的属性,从而取得屏幕的高度和宽度
  • getMetrics
  • getDisplay
  • getScreen
  • getWindows

获取屏幕密度  getScreen

获取设备屏幕大小 getDisplay

获得屏幕的属性,从而取得屏幕的高度和宽度 getMetrics

获得window对象 getWindows

发表于 2017-10-26 14:11:42 回复(0)
WindowManager manager = this.getWindowManager();
		DisplayMetrics outMetrics = new DisplayMetrics();
		manager.getDefaultDisplay().getMetrics(outMetrics);
		int width = outMetrics.widthPixels;
		int height = outMetrics.heightPixels;
发表于 2017-06-06 15:07:39 回复(1)

  获取屏幕密度  getScreen    获取设备屏幕大小 getDisplay    获得屏幕的属性,从而取得屏幕的高度和宽度 getMetrics    获得window对象 getWindows 

发表于 2018-08-24 07:22:30 回复(0)