android - 如何在惰性列表中使图像更大(高度)

标签 android android-listview lazy-loading android-imageview

我正在使用惰性列表项目开发图书阅读器 Here is Link

问题:我看到了 Lazy List 的外观 高度小的页面和模糊的图像非常难以阅读。

enter image description here

我想要这个: 它应该像这样看起来清晰(不是模糊)和整页高度。

enter image description here

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

  • 如何获得大约 600X921 的全分辨率图像。

我试过了,但没用 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" />

最佳答案

我相信,您正在寻找的解决方案就在这里(如果我错了请更正):

//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 的值没有任何问题。

这应该可以解决问题。

关于android - 如何在惰性列表中使图像更大(高度),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14621367/

相关文章:

android - 运动布局 : How to Limit the 'OnSwipe' event on a specific view instead of 'OnSwipe' on whole screen

java - 如何设置平铺可绘制对象的大小

java - Android ListActivity编译错误

android - 我想测量 ListView 的高度(getHight() = 0)

image - React Native 如何延迟加载图像

c# - 用户定义的属性是延迟加载还是急切加载

nested - Angular 9 嵌套延迟加载模块,带有嵌套路由器导出

android - 使用 -show_entries 获取音频 MAX_level 统计信息时,FFprobe 会更改 FPS

带有光标适配器滚动问题的android ListView

Android 记录到一个文件,有什么建议吗?