画布在打击真正的屏幕分辨率Surfaceview尺寸 [英] Size of a Canvas in a Surfaceview against real screen resolution

查看:475
本文介绍了画布在打击真正的屏幕分辨率Surfaceview尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用SurfaceView和帆布做一些借鉴,在我的480x800的电话,但我不明白这是怎么管理的,因为当我显示画布大小,它显示320x533(而我的屏幕是480×800)

I am trying to use the SurfaceView and the Canvas to make some draws, in my 480x800 phone, but I do not understand how this is managed, because when I display canvas size, it show 320x533 ( while my screen is 480x800 )

我tryied使用setFixedSize()在getHolder重置屏幕的分辨率,看起来做工精细,但它做了正确的方法,例如调整?

I tryied to use setFixedSize() on the getHolder to reset the canvas resolution, seems to work fine, but is it a correct way to do such resize ?

另一个麻烦是获得触摸事件的坐标,而我的画布似乎被调整,触摸事件是针对320x533屏幕仍匹配,我怎样才能改变这种状况?

Another trouble is getting the touch event coordinates, while my canvas seem to be resized, to touch events are still matched against a 320x533 screen, how can I change that ?

推荐答案

您的应用程序以兼容模式运行。您必须针对适当的API级别或在你的清单,你支持多种密度声明。

Your application is running in compatibility mode. You must either target the proper API level or declare in your manifest that you support multiple densities.

这篇关于画布在打击真正的屏幕分辨率Surfaceview尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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