Material design guidelines mention that cards can be constructed using blocks of content which include:

  • An optional header
  • A primary title
  • Rich media
  • Supporting text
  • Actions

These blocks can be organized to promote different types of content. Let’s consider some possible combinations of content blocks to build cards and how they can be implemented using ConstraintLayout.

1 Media 16:9 and supporting text


This article shows how to set the Bitmap into ImageView to keep ratio 16:9.

Since PercentFrameLayout and PercentRelativeLayout were deprecated in API level 26.0.0, I’d suggest you to consider using of ConstraintLayout to keep ratio 16:9 for your ImageView.

ConstraintLayout is really powerful tool to build Responsive UI for Android platform, you can find more details here Build a Responsive UI with ConstraintLayout.

Here is the example how to build your ImageView into ConstraintLayout to keep 16:9 ratio:

Or instead of editing your XML file, edit your layout directly in Layout Editor:

Eugene Brusov

Lead iOS and Android developer at eugenebrusov.com CEO at apploo (http://apploo-mobile.com)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store