Solution 1 :
In version of Glide 4.x , you can add RequestOptions through apply()
Glide
.with(context)
.load(path)
.apply(new RequestOptions().override(600, 200))
.into(imageViewResizeCenterCrop);
Problem :
I tried many answer from git and stackoverflow but i didn’t find right solution.
I used glide in gridview.
In 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>
in 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);
and my drawable is
<animated-rotate
xmlns_android="http://schemas.android.com/apk/res/android"
android_drawable="@drawable/people_image_loading_spinner"
android_pivotX="50%"
android_pivotY="50%"
/>
i want to resize my placeholder size without changes of original image scaletype(centerCrop).
problem is placehoder(loading bar image) is also in centercrop
currently its look like below image. i want to this loading bar 30×30 dp in center of imageview