How to make Images Larger (in height) in lazy list

谁说胖子不能爱 提交于 2019-12-19 10:03:46

问题


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" />

回答1:


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.



来源:https://stackoverflow.com/questions/14621367/how-to-make-images-larger-in-height-in-lazy-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!