public class

CardScrollView

extends FrameLayout

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.widget.FrameLayout
         ↳ android.support.wearable.view.CardScrollView

Class Overview

Designed to host a CardFrame and provides special support for scrolling with expansion in both the upward and downward directions.

Summary

[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
CardScrollView(Context context)
CardScrollView(Context context, AttributeSet attrs)
Public Methods
void addView(View child, int index, ViewGroup.LayoutParams params)
boolean canScrollHorizontally(int direction)
int getAvailableScrollDelta(int direction)
Indicates how far the container may be vertically scrolled in the given direction.
int getCardGravity()
Returns the current layout gravity for contained card frame.
int getExpansionDirection()
Returns the current expansion direction for the contained CardFrame.
float getExpansionFactor()
Returns the current expansion factor for the contained CardFrame.
boolean isExpansionEnabled()
Indicates if expansion is enabled.
WindowInsets onApplyWindowInsets(WindowInsets insets)
void setCardGravity(int gravity)
Applies gravity to adjust the vertical alignment of the contained card frame when it's shorter than the containing view.
void setExpansionDirection(int direction)
Control which direction expansion occurs.
void setExpansionEnabled(boolean enableExpansion)
Whether the height of the card is permitted to increase beyond the card layout bounds.
void setExpansionFactor(float expansionFactor)
Changes the expansion factor for the contained CardFrame.
Protected Methods
void onAttachedToWindow()
void onFinishInflate()
void onLayout(boolean changed, int left, int top, int right, int bottom)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
[Expand]
Inherited Methods
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 CardScrollView (Context context)

public CardScrollView (Context context, AttributeSet attrs)

Public Methods

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

public boolean canScrollHorizontally (int direction)

public int getAvailableScrollDelta (int direction)

Indicates how far the container may be vertically scrolled in the given direction.

When providing a positive direction value, the return value indicates the available increase in scroll position (how far the content can move up). When providing a negative direction value, the return value indicates the available decrease in scroll position (how far the content can move down).

Parameters
direction the direction value to check, only the sign of the value is significant

public int getCardGravity ()

Returns the current layout gravity for contained card frame.

public int getExpansionDirection ()

Returns the current expansion direction for the contained CardFrame.

public float getExpansionFactor ()

Returns the current expansion factor for the contained CardFrame.

public boolean isExpansionEnabled ()

Indicates if expansion is enabled.

public WindowInsets onApplyWindowInsets (WindowInsets insets)

public void setCardGravity (int gravity)

Applies gravity to adjust the vertical alignment of the contained card frame when it's shorter than the containing view.

Supported gravity values are either TOP or BOTTOM.

public void setExpansionDirection (int direction)

Control which direction expansion occurs. When content is taller than this container, this edge will fade to indicate expansion is possible. If expansion is disabled, this edge will simply be clipped. If the card is smaller than this layout, this setting has no effect.

Parameters
direction the direction for content expansion

public void setExpansionEnabled (boolean enableExpansion)

Whether the height of the card is permitted to increase beyond the card layout bounds. If enabled, content will expand the card up to the current expansion level. If taller, a fading edge will indicate that more expansion is possible.

Parameters
enableExpansion whether content will be allowed to expand

public void setExpansionFactor (float expansionFactor)

Changes the expansion factor for the contained CardFrame.

Protected Methods

protected void onAttachedToWindow ()

protected void onFinishInflate ()

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

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)