CardScrollView

public class CardScrollView
extends FrameLayout

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.support.wearable.view.CardScrollView


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

Summary

Inherited constants

From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.ViewGroup
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)

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

CardScrollView

CardScrollView (Context context)

Parameters
context Context

CardScrollView

CardScrollView (Context context,
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

Public methods

addView

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

Parameters
child View
index int
params ViewGroup.LayoutParams

canScrollHorizontally

boolean canScrollHorizontally (int direction)

Parameters
direction int
Returns
boolean

getAvailableScrollDelta

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 int: the direction value to check, only the sign of the value is significant
Returns
int

getCardGravity

int getCardGravity ()

Returns the current layout gravity for contained card frame.

Returns
int

See also:

getExpansionDirection

int getExpansionDirection ()

Returns the current expansion direction for the contained CardFrame.

Returns
int

See also:

getExpansionFactor

float getExpansionFactor ()

Returns the current expansion factor for the contained CardFrame.

Returns
float

See also:

isExpansionEnabled

boolean isExpansionEnabled ()

Indicates if expansion is enabled.

Returns
boolean

See also:

onApplyWindowInsets

WindowInsets onApplyWindowInsets (WindowInsets insets)

Parameters
insets WindowInsets
Returns
WindowInsets

setCardGravity

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.

Parameters
gravity int

setExpansionDirection

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 int: the direction for content expansion

setExpansionEnabled

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 boolean: whether content will be allowed to expand

See also:

setExpansionFactor

void setExpansionFactor (float expansionFactor)

Changes the expansion factor for the contained CardFrame.

Parameters
expansionFactor float

See also:

Protected methods

onAttachedToWindow

void onAttachedToWindow ()

onFinishInflate

void onFinishInflate ()

onLayout

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

Parameters
changed boolean
left int
top int
right int
bottom int

onMeasure

void onMeasure (int widthMeasureSpec,
                int heightMeasureSpec)

Parameters
widthMeasureSpec int
heightMeasureSpec int