我正在使用Lazy列表项目Here is Link
开发书籍阅读器问题:我看到了懒惰列表 高度小的页面和模糊的图像,非常难以阅读。
我想要这个: 它应该看起来很清晰(不是模糊)和像这样的高度整页。
我知道: 延迟列表加载位图的样本大小。
我尝试了这个,但没有帮助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" />
答案 0 :(得分:6)
我相信,您正在寻找的解决方案就在于此处(如果我错了,请纠正):
//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
的值没有任何问题。
这应该适合你。