Qad*_*ain 3 android lazy-loading android-listview android-imageview
我正在开发一个使用Lazy列表项目的书籍阅读器.这是链接
问题:我看到了Lazy List的 高度小页面和模糊的图像,这是非常难以阅读的.

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

我知道: 懒惰列表加载位图的样本大小.
我尝试了这个但没有帮助 main.xml
<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="fill_parent" />
Run Code Online (Sandbox Code Playgroud)
还有这个 item.xml
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="matrix"
android:src="@drawable/stub" />
Run Code Online (Sandbox Code Playgroud)
我相信,你正在寻找的解决方案就在于这里(如果我错了,请纠正):
//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;
}
Run Code Online (Sandbox Code Playgroud)
这是从第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没有任何问题.
这应该为你做的伎俩.
| 归档时间: |
|
| 查看次数: |
1138 次 |
| 最近记录: |