CardScrollView

public class CardScrollView
extends FrameLayout

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


This class is deprecated.
starting with Android Wear 2.0 it is no longer encouraged to use cards for apps' UI. If you are looking to implement vertical paging pattern, consider using the SnapHelper and a RecyclerView instead.

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

Summary

Inherited constants

Inherited fields

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

Public constructors

CardScrollView

public CardScrollView (Context context)

Parameters
context Context

CardScrollView

public CardScrollView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

Public methods

addView

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

Parameters
child View

index int

params ViewGroup.LayoutParams

canScrollHorizontally

public boolean canScrollHorizontally (int direction)

Parameters
direction int

Returns
boolean

getAvailableScrollDelta

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

Returns
int

getCardGravity

public int getCardGravity ()

Returns the current layout gravity for contained card frame.

Returns
int

getExpansionDirection

public int getExpansionDirection ()

Returns the current expansion direction for the contained CardFrame.

Returns
int

getExpansionFactor

public float getExpansionFactor ()

Returns the current expansion factor for the contained CardFrame.

Returns
float

isExpansionEnabled

public boolean isExpansionEnabled ()

Indicates if expansion is enabled.

Returns
boolean

onApplyWindowInsets

public WindowInsets onApplyWindowInsets (WindowInsets insets)

Parameters
insets WindowInsets

Returns
WindowInsets

setCardGravity

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 Gravity.TOP or Gravity.BOTTOM.

Parameters
gravity int

setExpansionDirection

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

setExpansionEnabled

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

setExpansionFactor

public void setExpansionFactor (float expansionFactor)

Changes the expansion factor for the contained CardFrame.

Parameters
expansionFactor float

Protected methods

onAttachedToWindow

protected void onAttachedToWindow ()

onFinishInflate

protected void onFinishInflate ()

onLayout

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

Parameters
changed boolean

left int

top int

right int

bottom int

onMeasure

protected void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int