简体   繁体   English

Android Galaxy Nexus位图问题

[英]Android Galaxy Nexus Bitmap Issue

I am developing an app that uses a custom view where a bitmap is set and can be moved and zoomed by the touch screen input. 我正在开发一个使用自定义视图的应用程序,在该视图中设置了位图,并且可以通过触摸屏输入对其进行移动和缩放。 The bitmap I use is scaled down to be the smallest size that is larger than the screen size. 我使用的位图按比例缩小为大于屏幕尺寸的最小尺寸。

The app works for all devices that I have tested with (about 10 different devices ranging from 2.2~2.3.6 with various screen dimensions), except with Galaxy Nexus. 该应用程序适用于我测试过的所有设备(大约10种不同的设备,范围从2.2到2.3.6,具有不同的屏幕尺寸),但Galaxy Nexus除外。

On Galaxy Nexus when the bitmap is larger than the screen size and I try to move it the bitmap leaves traces and doesn't draw what it's supposed to. 在Galaxy Nexus上,当位图大于屏幕大小时,我尝试将其移动,但位图会留下痕迹,并且无法绘制应有的图像。 I have conducted various tests and found out that: 我进行了各种测试,发现:

-it has nothing to do with where the bitmap is drawn. -它与位图的绘制位置无关。

-it is always the right side and or the bottom side that always has the issue -总是有问题的是右侧和/或底部

-if I rotate the bitmap before drawing on the view and make it fit within the screen, it works fine. -如果在绘制视图之前旋转位图并使其适合屏幕,则效果很好。

-happens even when hardware acceleration is turned off. -即使关闭硬件加速也会发生。

So my best guess as of now is that somehow the bitmap is not loaded into the memory properly (only bitmaps within size of the screen will load properly). 因此,到目前为止,我最好的猜测是某种程度上位图没有正确加载到内存中(只有屏幕大小内的位图才能正确加载)。 It seems to be an issue with android 4.0, but not sure as I only own 1 device that has android 4.0. 似乎是android 4.0的问题,但不确定,因为我只有1台具有android 4.0的设备。 If anyone knows how to solve this problem, or knows what the problem is it will be great help. 如果有人知道如何解决此问题,或者知道是什么问题,那将是很大的帮助。 Thanks a lot in advance. 非常感谢。

I solved the problem! 我解决了问题! It was the view's size... I guess from android 4.0, you have to make sure the view is larger than the bitmap you wish to draw on it. 这是视图的大小...我猜是从android 4.0开始的,您必须确保视图大于要在其上绘制的位图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM