Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] android – How to resize placeholder drawable image with glide?

Posted on November 14, 2022

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

enter image description here

READ  [ANSWERED] java - Check if item in text file in JSON format Android Studio
Powered by Inline Related Posts

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress