Android 获取屏幕分辨率的例子
2010-09-10 00:45:00 来源:WEB开发网核心提示:Drawable drawable = resources.getDrawable(R.drawable.red);tv.setBackgroundDrawable(drawable);tv.setTextColor(Color.GREEN);DisplayMetrics dm = new DisplayMetrics
Drawable drawable = resources.getDrawable(R.drawable.red);
tv.setBackgroundDrawable(drawable);
tv.setTextColor(Color.GREEN);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
tv.setText("屏幕分辨率为:"+dm.widthPixels+" * "+dm.heightPixels);
}
}
运行结果如下:
更多精彩
赞助商链接