ProductImageView

ProductImageView
ProductImageView

  1. ProductImageView with aspect ratio configured to 1
  2. ProductImageView with aspect ratio configured to 1.5

ProductImageView is an ImageView which scales the height based on the aspect ratio defined in the XML property aspect_ratio_image_view. The width and height are calculated as:

productImageView.width = measuredWidth
productImageView.height = (measuredWidth * aspectRatio)

Usage

You can use it in the layout: In the layout:

<com.poqstudio.app.platform.view.common.ProductImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:imageUrl="@{viewModel.imageUrl}"
app:shimmerPlaceholder="@{true}" />

The app:imageUrl= and app:shimmerPlaceholders= are available for all ImageViews as bindingAdapter methods.