public class

CardFrame

extends ViewGroup

Note: The Wearable Support Library classes under the android.support.wearable package are subject to change. For the full Android API reference, see Reference.

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.wearable.view.CardFrame

Class Overview

Wraps a view in a card-styled frame with a white background, rounded corners and a light drop-shadow. This layout is designed to be given a height of WRAP_CONTENT within a container with a fixed height.

To function properly, this view should be contained within a CardScrollView. A CardFragment provides this automatically.

Summary

Constants
int EXPAND_DOWN
int EXPAND_UP
float NO_EXPANSION
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
CardFrame(Context context)
CardFrame(Context context, AttributeSet attrs)
CardFrame(Context context, AttributeSet attrs, int defStyle)
Public Methods
void addView(View child)
void addView(View child, int index)
void addView(View child, int index, ViewGroup.LayoutParams params)
void addView(View child, ViewGroup.LayoutParams params)
int getContentPaddingBottom()
Returns the inner padding before the Card's bottom edge
int getContentPaddingLeft()
Returns the inner padding after the Card's left edge
int getContentPaddingRight()
Returns the inner padding before the Card's right edge
int getContentPaddingTop()
Returns the inner padding after the Card's top edge
int getExpansionDirection()
Returns the current expansion direction, either EXPAND_UP or EXPAND_DOWN.
float getExpansionFactor()
Returns the current expansionFactor which is the maximum height of this view as a multiple of the parent view's height.
boolean isExpansionEnabled()
Indicates whether expansion is on.
WindowInsets onApplyWindowInsets(WindowInsets insets)
void onInitializeAccessibilityEvent(AccessibilityEvent event)
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
void setExpansionDirection(int direction)
Sets the direction in which content expands.
void setExpansionEnabled(boolean enabled)
Enables support contents which maybe be larger than the card's container.
void setExpansionFactor(float expansionFactor)
Sets the allowed expansion amount as a multiple of the parent height.
boolean shouldDelayChildPressedState()
Protected Methods
boolean drawChild(Canvas canvas, View child, long drawingTime)
static int getDefaultSize(int size, int measureSpec, boolean greedy)
Get a default size, will be as small as possible unless forced by the parent, or greedy is specified.
void onAttachedToWindow()
void onLayout(boolean changed, int left, int top, int right, int bottom)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
[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

Constants

public static final int EXPAND_DOWN

Constant Value: 1 (0x00000001)

public static final int EXPAND_UP

Constant Value: -1 (0xffffffff)

public static final float NO_EXPANSION

Constant Value: 1.0

Public Constructors

public CardFrame (Context context)

public CardFrame (Context context, AttributeSet attrs)

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

Public Methods

public void addView (View child)

public void addView (View child, int index)

public void addView (View child, int index, ViewGroup.LayoutParams params)

public void addView (View child, ViewGroup.LayoutParams params)

public int getContentPaddingBottom ()

Returns the inner padding before the Card's bottom edge

public int getContentPaddingLeft ()

Returns the inner padding after the Card's left edge

public int getContentPaddingRight ()

Returns the inner padding before the Card's right edge

public int getContentPaddingTop ()

Returns the inner padding after the Card's top edge

public int getExpansionDirection ()

Returns the current expansion direction, either EXPAND_UP or EXPAND_DOWN.

public float getExpansionFactor ()

Returns the current expansionFactor which is the maximum height of this view as a multiple of the parent view's height.

public boolean isExpansionEnabled ()

Indicates whether expansion is on. A CardFrame will increase in height up to expansionFactor times the parent view's height. When expansion is enabled, content which is taller than this will have a fading effect applied to the expanding edge, otherwise content is simply clipped.

public WindowInsets onApplyWindowInsets (WindowInsets insets)

public void onInitializeAccessibilityEvent (AccessibilityEvent event)

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

public void setExpansionDirection (int direction)

Sets the direction in which content expands. Determines whether the top or bottom edge receives the fading edge appearance and whether more content is viewed by scrolling up or down, after increasing the expansion factor.

public void setExpansionEnabled (boolean enabled)

Enables support contents which maybe be larger than the card's container. When expansion is enabled, and the contents are larger than the card, the top or bottom edge will fade to indicate this. The expansion factor must also be increased to allow the card to increase in height.

public void setExpansionFactor (float expansionFactor)

Sets the allowed expansion amount as a multiple of the parent height. If expansion is enabled, the card will grow up to this height as needed to accommodate content.

public boolean shouldDelayChildPressedState ()

Protected Methods

protected boolean drawChild (Canvas canvas, View child, long drawingTime)

protected static int getDefaultSize (int size, int measureSpec, boolean greedy)

Get a default size, will be as small as possible unless forced by the parent, or greedy is specified.

protected void onAttachedToWindow ()

protected void onLayout (boolean changed, int left, int top, int right, int bottom)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)