【发布时间】:2020-07-13 03:22:02
【问题描述】:
我从 git 和 stackoverflow 尝试了很多答案,但我没有找到正确的解决方案。
我在 gridview 中使用了 glide。 在xml中
<SquareRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/people_raw_relative_layout">
<ImageView
android:id="@+id/people_raw_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:layout_marginBottom="2dp"
android:background="?attr/appBackground"
android:scaleType="centerCrop"/>
</SquareRelativeLayout>
在onBindViewHolder
GlideApp.with(mContext).load(currentThumb).placeholder(R.drawable.people_image_loading_ppa).transition(DrawableTransitionOptions.withCrossFade(1000))
.apply(new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.skipMemoryCache(true)
.dontTransform()
.fitCenter()
.priority(Priority.IMMEDIATE)
.encodeFormat(Bitmap.CompressFormat.PNG)
.format(DecodeFormat.DEFAULT)).into(peopleViewHolder.imageView);
我的drawable是
<animated-rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/people_image_loading_spinner"
android:pivotX="50%"
android:pivotY="50%"
/>
我想在不改变原始图像比例类型(centerCrop)的情况下调整占位符大小。 问题是占位符(加载条图像)也在 centercrop 目前它看起来像下图。我想要这个加载栏 30x30 dp 在 imageview 的中心
【问题讨论】:
标签: android gridview android-glide