android.support.wearable.view
Class CardFrame

java.lang.Object
  extended by ViewGroup
      extended by android.support.wearable.view.CardFrame

public class CardFrame
extends ViewGroup

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.

In most cases, developers will contain this view within a CardScrollView, or use a CardFragment which provides a CardFrame inside a CardScrollView.


Field Summary
static int EXPAND_DOWN
           
static int EXPAND_UP
           
static float NO_EXPANSION
           
 
Constructor Summary
CardFrame(Context context)
           
CardFrame(Context context, AttributeSet attrs)
           
CardFrame(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 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)
           
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.
 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)
           
protected  void onAttachedToWindow()
           
 void onInitializeAccessibilityEvent(AccessibilityEvent event)
           
 void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
           
protected  void onLayout(boolean changed, int left, int top, int right, int bottom)
           
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_EXPANSION

public static final float NO_EXPANSION
See Also:
Constant Field Values

EXPAND_UP

public static final int EXPAND_UP
See Also:
Constant Field Values

EXPAND_DOWN

public static final int EXPAND_DOWN
See Also:
Constant Field Values
Constructor Detail

CardFrame

public CardFrame(Context context)

CardFrame

public CardFrame(Context context,
                 AttributeSet attrs)

CardFrame

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

setExpansionEnabled

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.


setExpansionDirection

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.


setExpansionFactor

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.


getExpansionDirection

public int getExpansionDirection()
Returns the current expansion direction, either EXPAND_UP or EXPAND_DOWN.


isExpansionEnabled

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.


getExpansionFactor

public float getExpansionFactor()
Returns the current expansionFactor which is the maximum height of this view as a multiple of the parent view's height.


onAttachedToWindow

protected void onAttachedToWindow()

onApplyWindowInsets

public WindowInsets onApplyWindowInsets(WindowInsets insets)

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)

getDefaultSize

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.


onLayout

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

drawChild

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

addView

public void addView(View child)

addView

public void addView(View child,
                    int index)

addView

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

addView

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

shouldDelayChildPressedState

public boolean shouldDelayChildPressedState()

onInitializeAccessibilityEvent

public void onInitializeAccessibilityEvent(AccessibilityEvent event)

onInitializeAccessibilityNodeInfo

public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)