Android开发Android技术知识Android开发

XrecyclerView下拉图片错乱解决 Glide图片占位符

2019-08-01  本文已影响18人  Ad大成

在开发过程中加载更多是非常常见的,有两个细节需要注意

1图片的大小问题 图片宽不要设置wrap_content
设置android:adjustViewBounds="true" 正好到屏幕边缘

    <ImageView
        android:adjustViewBounds="true"
        android:id="@+id/iv_item"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

2 就是在适配器里添加占位符了
apply(new RequestOptions().placeholder(R.mipmap.ic_launcher))

     Glide.with(context).load(list.get(position).getUrl())
                .apply(new RequestOptions().placeholder(R.mipmap.ic_launcher))
                .into(holder.iv);
上一篇 下一篇

猜你喜欢

热点阅读