如何在惰性列表中使图像更大(高度) [英] How to make Images Larger (in height) in lazy list

查看:13
本文介绍了如何在惰性列表中使图像更大(高度)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用懒惰列表项目开发图书阅读器.我正在链接它,以便您可以检查源代码并与您的代码进行比较.

您需要在此处更改此位:final int REQUIRED_SIZE=70.请注意,此数字需要 2 的幂.默认70,你会得到小图像,当在需要显示更大图片的应用程序中使用时,它们看起来会失真.反复试验,直到您对结果感到满意为止.

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

这应该对你有用.

I m developing a book reader using the Lazy list project Here is Link

Problem: I m getting this look of Lazy List Small pages in height and blurred image which is very difficult to read.

I want this: It should look clear (not Blurred) and full page in height like this.

I know: Lazy list loads the sample size of bitmaps.

  • how can I get the images in full resolution which is about 600X921.

I tried this but not helpful main.xml

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

and this item.xml

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

解决方案

I believe, the solution you are looking for, lies in this bit here (please do correct if I am wrong though):

//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;
}

This is from Line 99 to line 108 here: https://github.com/thest1/LazyList/blob/master/src/com/fedorvlasov/lazylist/ImageLoader.java. I am linking this so that you can check the code from the source and compare with your code.

You will need to change this bit here: final int REQUIRED_SIZE=70. Note that this number needs to the power of 2. With the default of 70, you will get small images and when used in applications which need to display bigger pictures, they will look distorted. Play around with that till you are satisfied with the result.

I personally use the value of final int REQUIRED_SIZE=512 without any problems whatsoever.

This should do the trick for you.

这篇关于如何在惰性列表中使图像更大(高度)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆