如何获得屏幕尺寸的大小在Android的画布? [英] How to get the size of the screen size in a canvas in android?

查看:118
本文介绍了如何获得屏幕尺寸的大小在Android的画布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够得到正常活动的屏幕尺寸,但我需要在画布视图和放大器屏幕尺寸;按照操作与it.Any片段上这将是helpful.Thanks。

I am able to get the screen size in the normal activity but I need to get the screen size in a canvas view & manipulate in accordance with it.Any snippet on it will be helpful.Thanks.

推荐答案

我得到widthPixels heightPixels使用荷兰国际集团这一点。

i got widthPixels heightPixels use ing this.

DisplayMetrics metrics = getBaseContext().getResources().getDisplayMetrics();         
  int w = metrics.widthPixels;
  int h = metrics.heightPixels;

这篇关于如何获得屏幕尺寸的大小在Android的画布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆