2

I have two screens of the app.One is edit screen and another is modify screen.I am loading the images into list using Glide in edit screen with 100*100 size successfully using below code.

public static void loadEditImage(ImageView view, String imageUrl){
        Glide.with(view.getContext())
                .load(imageUrl)
                .transform(new CircleTransform(mContext))
//                .placeholder(R.drawable.car_logo_bg)
                .override(600, 200)

                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .skipMemoryCache(true)
                .into(view);
    }

Same image i am trying to display in modify screen with 140*140 size using same image URL. But the image its displaying the size with 100*100 instead of 140*140. Below glide code is using for this screen.

public static void loadModifyImage(ImageView view, String modifyImageUrl){
        Glide.with(view.getContext())
                .load(modifyImageUrl)
                .asBitmap()
                .transform(new CircleTransform(mContext))
//                .placeholder(R.drawable.car_logo_bg)
                .override(600, 200)

//                .centerCrop()
//                .fitCenter()
                .diskCacheStrategy(DiskCacheStrategy.NONE)
                .skipMemoryCache(true)
                .signature(new StringSignature(String.valueOf(System.currentTimeMillis())))
                .into(view);
    }

Please let me know if i am doing anything wrong and help me to display the image with the size of 140*140.

Zoe
  • 27,060
  • 21
  • 118
  • 148
malli
  • 642
  • 2
  • 12
  • 30

1 Answers1

0

Try

imageview.setLayoutParams(140, 140);
Zoe
  • 27,060
  • 21
  • 118
  • 148
graypacket
  • 98
  • 1
  • 11
  • I have given wrap_content to both.Because i am loading different size images from network.So if i put fixed size,small images lossing the quality and big images overriding on top of imageview. – malli Aug 03 '17 at 06:18
  • You can get the screen width https://stackoverflow.com/questions/4743116/get-screen-width-and-height and then according to that you can set fixed size. – graypacket Aug 03 '17 at 08:18
  • I don't want to load image as per the screen resolution.The ImageView size is fixed like 140*140.Need to load image into it using glide – malli Aug 03 '17 at 09:14
  • Hey, why to use override(600, 200)? Try override(100, 100) for edit screen and (140, 140) for modify screen. – graypacket Aug 03 '17 at 15:44