Android Surfaceview和不同分辨率问题
我遇到了一个奇怪的问题,但我无法找到解决它的方法。
场景
- 我有一个 Surfaceview,我在其上的不同位置绘制一些图像。首先,我为 l/m/hdip 可绘制文件创建了文件夹,一切正常。然后我决定只将一个文件夹设置为可绘制,并让 Android 负责调整大小。所以我删除了drawable-mdip和drawable-ldip文件夹,将所有drawable-hdip内容移动到drawable文件夹并运行应用程序。
问题
- 当资源位于drawable-hdip 中时,surfaceview 按预期处理图像。一切看起来都很好而且就位。将 hdip 资源移至可绘制资源后,surfaceview 上的所有内容都过大,就像所有内容都处于 130% 缩放状态一样。我找不到解决此问题的方法,因为我找不到它进行此缩放的原因。测试设备是 Galaxy S,所以看起来应该不错。
任何答案都将不胜感激。
I have encountered a weird problem and I can't manage a way to solve it.
Scenario
- I have a Surfaceview on which I draw some images on different positions. First I created folders for l/m/hdip drawables and things worked fine. Then I decided to make only one folder drawable and let Android take care of the sizing. So I deleted the drawable-mdip and drawable-ldip folders, I moved all drawable-hdip contents to drawable folder and run the application.
Problem
- When resources were in drawable-hdip the surfaceview handeled the images as supposed to. Everything looked good and in place. After moving the hdip resources to drawable, everything on the surfaceview is oversized, it's like everything is at 130% zoom. I can't find a way to fix this because I can't find a reason why it makes this zoom. The test device is a Galaxy S so it should look good.
Any answer is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SurfaceView 在调整图像大小方面存在问题,因此解决此问题的最佳方法是为您想要定位的每个分辨率创建可绘制文件夹。
SurfaceView has problems with resizing images, so the best way for you to solve this problem is to create drawable folders for each resolution you want to target.