Android APIs
public class

ShadowOverlayContainer

extends ViewGroup
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.v17.leanback.widget.ShadowOverlayContainer

Class Overview

ShadowOverlayContainer Provides a SDK version independent wrapper container to take care of shadow and/or color overlay.

Shadow and color dimmer overlay are both optional. When shadow is used, it's user's responsibility to properly call setClipChildren(false) on parent views if the shadow can appear outside bounds of parent views. prepareParentForShadow(ViewGroup) must be called on parent of container before using shadow. Depending on sdk version, optical bounds might be applied to parent.

initialize(boolean, boolean, boolean) must be first called on the container to initialize shadows and/or color overlay. Then call wrap(View) to insert wrapped view into container.

Call setShadowFocusLevel(float) to control shadow alpha.

Call setOverlayColor(int) to control overlay color.

Summary

[Expand]
Inherited XML Attributes
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ShadowOverlayContainer(Context context)
ShadowOverlayContainer(Context context, AttributeSet attrs)
ShadowOverlayContainer(Context context, AttributeSet attrs, int defStyle)
Public Methods
void initialize(boolean hasShadow, boolean hasColorDimOverlay)
This method is deprecated. use initialize(boolean, boolean, boolean) instead.
void initialize(boolean hasShadow, boolean hasColorDimOverlay, boolean roundedCorners)
Initialize shadows, color overlay, and rounded corners.
static void prepareParentForShadow(ViewGroup parent)
prepareParentForShadow(ViewGroup) must be called on parent of container before using shadow.
void setOverlayColor(int overlayColor)
Set color (with alpha) of the overlay.
void setShadowFocusLevel(float level)
Set shadow focus level (0 to 1).
static boolean supportsShadow()
Return true if the platform sdk supports shadow.
void wrap(View view)
Inserts view into the wrapper.
Protected Methods
void onLayout(boolean changed, int l, int t, int r, int b)
Called from layout when this view should assign a size and position to each of its children.
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

[Expand]
Inherited Methods
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 ShadowOverlayContainer (Context context)

public ShadowOverlayContainer (Context context, AttributeSet attrs)

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

Public Methods

public void initialize (boolean hasShadow, boolean hasColorDimOverlay)

This method is deprecated.
use initialize(boolean, boolean, boolean) instead.

Initialize shadows, color overlay.

public void initialize (boolean hasShadow, boolean hasColorDimOverlay, boolean roundedCorners)

Initialize shadows, color overlay, and rounded corners. All are optional.

public static void prepareParentForShadow (ViewGroup parent)

prepareParentForShadow(ViewGroup) must be called on parent of container before using shadow. Depending on sdk version, optical bounds might be applied to parent.

public void setOverlayColor (int overlayColor)

Set color (with alpha) of the overlay.

public void setShadowFocusLevel (float level)

Set shadow focus level (0 to 1). 0 for unfocused, 1f for fully focused.

public static boolean supportsShadow ()

Return true if the platform sdk supports shadow.

public void wrap (View view)

Inserts view into the wrapper.

Protected Methods

protected void onLayout (boolean changed, int l, int t, int r, int b)

Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.

Parameters
changed This is a new size or position for this view
l Left position, relative to parent
t Top position, relative to parent
r Right position, relative to parent
b Bottom position, relative to parent

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents.

CONTRACT: When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by measure(int, int). Calling the superclass' onMeasure(int, int) is a valid use.

The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override onMeasure(int, int) to provide better measurements of their content.

If this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (getSuggestedMinimumHeight() and getSuggestedMinimumWidth()).

Parameters
widthMeasureSpec horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
heightMeasureSpec vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.