Stay organized with collections Save and categorize content based on your preferences.
added in version 22.1.0
belongs to Maven artifact


public class ImageCardView
extends BaseCardView

   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout

A subclass of BaseCardView with an ImageView as its main region. The ImageCardView is highly customizable and can be used for various use-cases by adjusting the ImageViewCard's type to any combination of Title, Content, Badge or ImageOnly.


There are two different ways to style the ImageCardView.
No matter what way you use, all your styles applied to an ImageCardView have to extend the style Widget_Leanback_ImageCardViewStyle.


 <style name="CustomImageCardViewStyle" parent="Widget.Leanback.ImageCardViewStyle">
        <item name="cardBackground">#F0F</item>
        <item name="lbImageCardViewType">Title|Content</item>
   <style name="CustomImageCardTheme" parent="Theme.Leanback">
        <item name="imageCardViewStyle">@style/CustomImageCardViewStyle</item>
        <item name="imageCardViewInfoAreaStyle">@style/ImageCardViewColoredInfoArea</item>
        <item name="imageCardViewTitleStyle">@style/ImageCardViewColoredTitle</item>

The first possibility is to set custom Styles in the Leanback Theme's attributes imageCardViewStyle, imageCardViewTitleStyle etc. The styles set here, is the default style for all ImageCardViews.

The second possibility allows you to style a particular ImageCardView. This is useful if you want to create multiple types of cards. E.g. you might want to display a card with only a title and another one with title and content. Thus you need to define two different ImageCardViewStyles and two different themes and apply them to the ImageCardViews. You can do this by using a the ImageCardView(Context) constructor and passing a ContextThemeWrapper with the custom ImageCardView theme id.

Example (using constructor):

 new ImageCardView(new ContextThemeWrapper(context,;

You can style all ImageCardView's components such as the title, content, badge, infoArea and the image itself by extending the corresponding style and overriding the specific attribute in your custom ImageCardView theme.


The ImageCardView contains three components which can be combined in any combination:
  • Title: The card's title
  • Content: A short description
  • Badge: An icon which can be displayed on the right or left side of the card.
In order to choose the components you want to use in your ImageCardView, you have to specify them in the lbImageCardViewType attribute of your custom ImageCardViewStyle. You can combine the following values: Title, Content, IconOnRight, IconOnLeft, ImageOnly.


 <style name="CustomImageCardViewStyle" parent="Widget.Leanback.ImageCardViewStyle">
        <item name="lbImageCardViewType">Title|Content|IconOnLeft</item>
 <style name="CustomImageCardViewStyle" parent="Widget.Leanback.ImageCardViewStyle">
        <item name="lbImageCardViewType">ImageOnly</item>


XML attributes








Inherited constants

From class
From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

ImageCardView(Context context, int themeResId)

This constructor was deprecated in API level 24.1.0. Calling this constructor inefficiently creates one ContextThemeWrapper per card, you should share it in card Presenter: wrapper = new ContextThemeWrapper(context, themResId); return new ImageCardView(wrapper);

ImageCardView(Context context, AttributeSet attrs, int defStyleAttr)
ImageCardView(Context context)
ImageCardView(Context context, AttributeSet attrs)

Public methods

Drawable getBadgeImage()

Returns the badge image drawable.

CharSequence getContentText()

Returns the content text.

Drawable getInfoAreaBackground()

Returns the info area background drawable.

Drawable getMainImage()

Returns the ImageView drawable.

final ImageView getMainImageView()

Returns the main image view.

CharSequence getTitleText()

Returns the title text.

boolean hasOverlappingRendering()
void setBadgeImage(Drawable drawable)

Sets the badge image drawable.

void setContentText(CharSequence text)

Sets the content text.

void setInfoAreaBackground(Drawable drawable)

Sets the info area background drawable.

void setInfoAreaBackgroundColor(int color)

Sets the info area background color.

void setMainImage(Drawable drawable, boolean fade)

Sets the image drawable with optional fade-in animation.

void setMainImage(Drawable drawable)

Sets the image drawable with fade-in animation.

void setMainImageAdjustViewBounds(boolean adjustViewBounds)

Enables or disables adjustment of view bounds on the main image.

void setMainImageDimen