2016-03-05 77 views
0

我想用ImageView显示图片。但我的图像尺寸是618 * 12956.ImageView未显示某些设备

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <ImageView 
     android:id="@+id/imageViewKonu" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:adjustViewBounds="true" 
     android:scaleType="fitXY" /> 
</ScrollView> 

在GT-5830上看起来很好。但是,在与HTC Desire 820滑动时出现障碍。而不是用注释3显示。我可以为所有显示流畅的设备做些什么?

回答

3

该映像将消耗30.5MB的堆空间(假设位深度的值为4个字节/像素,则默认ARGB_8888值)。有大量的设备,其中你的整个应用程序没有30.5MB的堆空间,更不用说一个大的块。因此,您将在许多设备上遇到OutOfMemoryError

您将需要使用一些东西,只需在任何一次需要的图像部分加载,而不是ScrollView内部的ImageViewDave Morrissey's SubsamplingScaleImageView就是一个例子。

+0

谢谢,但它的外观http://i.hizliresim.com/MpgnAg.png但我想http://hizliresim.com/Wk9ML8 –

+0

@SerhatHacıoğlu:检查通过[配置文件](https:// github。 com/davemorrissey/subsampling-scale-image-view/wiki/07.-Configuration)来查看你可能需要什么。即使这个特定的小部件无法处理它,你也需要沿着这些线来做一些事情,所以你不要一次加载整个图像。 – CommonsWare

+0

我什么都做不了。问题继续 –

相关问题