Android APIs
public class

ImageCardView

extends BaseCardView
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.support.v17.leanback.widget.BaseCardView
           ↳ android.support.v17.leanback.widget.ImageCardView

Class Overview

A subclass of BaseCardView with an ImageView as its main region.

Summary

[Expand]
Inherited XML Attributes
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Constants
From class android.support.v17.leanback.widget.BaseCardView
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ImageCardView(Context context)
ImageCardView(Context context, AttributeSet attrs)
ImageCardView(Context context, AttributeSet attrs, int defStyle)
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()
Returns whether this View has content which overlaps.
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 setMainImageDimensions(int width, int height)
Sets the layout dimensions of the ImageView.
void setMainImageScaleType(ImageView.ScaleType scaleType)
Sets the ScaleType of the main image.
void setTitleText(CharSequence text)
Sets the title text.
Protected Methods
void onAttachedToWindow()
This is called when the view is attached to a window.
void onDetachedFromWindow()
This is called when the view is detached from a window.
[Expand]
Inherited Methods
From class android.support.v17.leanback.widget.BaseCardView
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public Constructors

public ImageCardView (Context context)

public ImageCardView (Context context, AttributeSet attrs)

public ImageCardView (Context context, AttributeSet attrs, int defStyle)

Public Methods

public Drawable getBadgeImage ()

Returns the badge image drawable.

public CharSequence getContentText ()

Returns the content text.

public Drawable getInfoAreaBackground ()

Returns the info area background drawable.

public Drawable getMainImage ()

Returns the ImageView drawable.

public final ImageView getMainImageView ()

Returns the main image view.

public CharSequence getTitleText ()

Returns the title text.

public boolean hasOverlappingRendering ()

Returns whether this View has content which overlaps.

This function, intended to be overridden by specific View types, is an optimization when alpha is set on a view. If rendering overlaps in a view with alpha < 1, that view is drawn to an offscreen buffer and then composited into place, which can be expensive. If the view has no overlapping rendering, the view can draw each primitive with the appropriate alpha value directly. An example of overlapping rendering is a TextView with a background image, such as a Button. An example of non-overlapping rendering is a TextView with no background, or an ImageView with only the foreground image. The default implementation returns true; subclasses should override if they have cases which can be optimized.

The current implementation of the saveLayer and saveLayerAlpha methods in Canvas necessitates that a View return true if it uses the methods internally without passing the CLIP_TO_LAYER_SAVE_FLAG.

Returns
  • true if the content in this view might overlap, false otherwise.

public void setBadgeImage (Drawable drawable)

Sets the badge image drawable.

public void setContentText (CharSequence text)

Sets the content text.

public void setInfoAreaBackground (Drawable drawable)

Sets the info area background drawable.

public void setInfoAreaBackgroundColor (int color)

Sets the info area background color.

public void setMainImage (Drawable drawable, boolean fade)

Sets the image drawable with optional fade-in animation.

public void setMainImage (Drawable drawable)

Sets the image drawable with fade-in animation.

public void setMainImageAdjustViewBounds (boolean adjustViewBounds)

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

public void setMainImageDimensions (int width, int height)

Sets the layout dimensions of the ImageView.

public void setMainImageScaleType (ImageView.ScaleType scaleType)

Sets the ScaleType of the main image.

public void setTitleText (CharSequence text)

Sets the title text.

Protected Methods

protected void onAttachedToWindow ()

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

protected void onDetachedFromWindow ()

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.