How to get the size of the screen size in a canvas in android?

情到浓时终转凉″ 提交于 2019-11-30 19:49:50

问题


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.


回答1:


i got widthPixels heightPixels use ing this.

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


来源:https://stackoverflow.com/questions/9124797/how-to-get-the-size-of-the-screen-size-in-a-canvas-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!