如何使图像放大(高)的懒列表 [英] How to make Images Larger (in height) in lazy list

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

问题描述

我米开发利用懒列表项目一本书的读者这里是链接

问题:我米得到这个样子的懒列表 小页面的高度和模糊图像,这是非常难读

我想这样的: 它看起来应该清晰(不模糊)和全页面的高度是这样的。

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

  • 我怎样才能得到全分辨率图像大约是600X921。

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

 <的ListView
    机器人:ID =@ + ID /列表
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =FILL_PARENT/>
 

和本 item.xml

 < ImageView的
    机器人:ID =@ + ID /图像
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:scaleType =矩阵
    机器人:SRC =@可绘制/存根/>
 

解决方案

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

  //找到正确的比例值。它应该是2的幂。
最终诠释REQUIRED_SIZE = 70;
INT width_tmp = o.outWidth,height_tmp = o.outHeight;
int标= 1;
而(真){
    如果(width_tmp / 2'; REQUIRED_SIZE || height_tmp / 2'; REQUIRED_SIZE)
        打破;
    width_tmp / = 2;
    height_tmp / = 2;
    规模* = 2;
}
 

这是从99号线到线108位置:<一href="https://github.com/thest1/LazyList/blob/master/src/com/fedorvlasov/lazylist/ImageLoader.java">https://github.com/thest1/LazyList/blob/master/src/com/fedorvlasov/lazylist/ImageLoader.java.我联系起来,这样就可以从源头上检查code和你的code比较。

您需要在这里更改此位:最终诠释REQUIRED_SIZE = 70 。请注意,这个数字需要的 2 的权力。随着 70 ,你会得到小图像,这就需要更大的显示画面的应用程序使用的默认时,他们会显得扭曲。玩弄了,直到您满意的结果。

我个人使用的最终诠释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天全站免登陆