繁体   English   中英

如何使图像在惰性列表中更大(高度)

[英]How to make Images Larger (in height) in lazy list

我正在使用Lazy列表项目开发一个书籍阅读器。 这是链接

问题:我看到了Lazy List的高度小页面和模糊的图像,这是非常难以阅读的。

在此输入图像描述

我想要这个:它应该看起来很清楚(不是模糊)和像这样的高度整页。

在此输入图像描述

我知道:懒惰列表加载位图的样本大小。

  • 如何以大约600X921的全分辨率获取图像。

我试过这个但没有帮助的main.xml

 <ListView
    android:id="@+id/list"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent" />

和这个item.xml

<ImageView
    android:id="@+id/image"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scaleType="matrix"
    android:src="@drawable/stub" />

我相信,你正在寻找的解决方案就在于这里( 如果我错了,请纠正 ):

//Find the correct scale value. It should be the power of 2.
final int REQUIRED_SIZE=70;
int width_tmp=o.outWidth, height_tmp=o.outHeight;
int scale=1;
while(true){
    if(width_tmp/2<REQUIRED_SIZE || height_tmp/2<REQUIRED_SIZE)
        break;
    width_tmp/=2;
    height_tmp/=2;
    scale*=2;
}

这是从第99行到第108行: https//github.com/thest1/LazyList/blob/master/src/com/fedorvlasov/lazylist/ImageLoader.java 我正在链接这个,以便您可以检查源代码并与您的代码进行比较。

您需要在此处更改此位: final int REQUIRED_SIZE= 70 请注意,此数字需要2的幂。 默认值为70 ,您将获得小图像,当在需要显示更大图片的应用程序中使用时,它们看起来会变形。 玩弄它直到你对结果感到满意。

我个人使用final int REQUIRED_SIZE=512的值,没有任何问题。

这应该为你做的伎俩。

暂无
暂无

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

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