Why do my images shrink after loading with glide library
Use .dontAnimate() method to solve the issue.
Glide.with(context) .using(new FirebaseImageLoader()) .load(pathReference) .dontAnimate() .placeholder(R.drawable.place_holder) .into(holder.logo);
Actually you have to give fix width and height to your image container(ImageView).
<ImageView
android:id="@+id/channelImage"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_centerHorizontal="true"
android:layout_margin="10dp"
android:src="@drawable/sama" />
Then when you call glide you have to override your width and height dynamically with override method. This is maximum Width and height for you container.
Glide.with(getActivity())
.load("your url")
.placeholder(R.drawable.tv2v_icon)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.fitCenter()
.override(500,500)
.into(channelImage);
hope this can help you.
Anyway there are methods like .fitCenter() or .centerCrop() .Try using this methods in
Glide.with(getApplicationContext())
.load("")
.centerCrop()
.placeholder(R.drawable.ic_launcher)
.crossFade()
.override(1000,1000)
.into(myImageView);
.
Following helped me:
1) Used adjustViewBounds = "true" in your Image View -> This will make the image view maintain its aspect ratio according to its image when it draws/redraws/resizes
2) Set layout_width = match_parent and layout_height = wrap_content for the recycler view's item view xml, and also for the Image View.
Reason:
Suppose Recycler view is set up with Grid Layout Manager having 2 columns in vertical orientation It will force the recycler view's item row's xml to be of half the screen width. Due to value of match_parent in the item row's and its chid's (imageview) layout_height attribute, it will result in image become half the screen's width. Now, due to adjustViewBounds = true, the image view would itself adjust its height to maintain the aspect ratio.