I have used shapeable image view in my application. I want to load shimmer as a place holder till the image loads in shapeable image view. But the shimmer is not loading. It just shows blank image view until image loads.
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/style_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:contentDescription="@string/rapturous"
android:scaleType="centerCrop"
app:shapeAppearanceOverlay="@style/roundedCornersImageView" />
val shimmer = Shimmer.AlphaHighlightBuilder()
.setDuration(1800)
.setBaseAlpha(0.7f)
.setHighlightAlpha(0.6f)
.setDirection(Shimmer.Direction.LEFT_TO_RIGHT)
.setAutoStart(true)
.build()
val shimmerDrawable = ShimmerDrawable().apply {
setShimmer(shimmer)
}
Glide.with(context).load(imageUrl).placeholder(shimmerDrawable).into(style_img)
I have tried using simple image view instead of shapeable image view and it works fine. But I want my image view to have rounded corners.
I am using implementation 'com.facebook.shimmer:shimmer:0.5.0' library for shimmer
It is probably because of the
shapeAppearanceOverlaythat affects the placeholder, another option would also be to use a normalImageView, since you mentioned that it works there, and put thisImageViewinside aCardVieworMaterialCardView, so with it now you are allow to define rounded corners, also if you don't want border define change it to0