@Override protected void convert(BaseViewHolder helper, GameListResp.Data data) { LinearLayout ic_linearLayout = (LinearLayout)helper.getView(R.id.ic_linearLayout); ViewGroup.LayoutParams params = ic_linearLayout.getLayoutParams(); params.height = UIUtils.getWidth()/16*9; ic_linearLayout.setLayoutParams(params); GlideApp.with(mContext).load(data.getImageUrl())..into((ImageView) helper.getView(R.id.ic_image)); }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools" android:id="@+id/ic_linearLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:id="@+id/ic_image" android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:scaleType="fitXY" tools:src="@mipmap/bond_ic_game_1" /> <ImageView android:id="@+id/ic_gameState" android:layout_width="60dp" android:layout_height="wrap_content" android:layout_gravity="right" android:layout_marginRight="12dp" android:layout_marginTop="7dp" android:adjustViewBounds="true" android:scaleType="fitXY" tools:src="@mipmap/bond_ic_game_ready" /> </LinearLayout>
RecyclerView Glide加载图片刷新时会闪一下
最新推荐文章于 2024-07-15 02:50:27 发布