How to make images large (in height) in a lazy list

I am developing a book reader using the Lazy list project. Here is the link

Problem: I get this look from the Lazy List Small pages, tall and blurry, which are very difficult to read.

enter image description here

I want this: It should look clear (not blurry) and a full page at that height.

enter image description here

I know: Lazy list loads the raster image sample size.

  • How can I get images in full resolution at about 600X921.

I tried this but not useful main.xml

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

and this is item.xml

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

I believe that the solution you are looking for here lies here (please do it right if I am wrong):

 //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 link 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 . Please note that this number must have a power of 2 . By default, 70 you get small images, and when used in applications that need to display large images, they will look distorted. Play with it until you are satisfied with the result.

I personally use final int REQUIRED_SIZE=512 without any problems.

This should do the trick for you.

+6
source

All Articles