android.support.wearable.view
Class CardScrollView

java.lang.Object
  extended by FrameLayout
      extended by android.support.wearable.view.CardScrollView

public class CardScrollView
extends FrameLayout

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


Constructor Summary
CardScrollView(Context context)
           
CardScrollView(Context context, AttributeSet attrs)
           
 
Method Summary
 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)
           
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)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CardScrollView

public CardScrollView(Context context)

CardScrollView

public CardScrollView(Context context,
                      AttributeSet attrs)
Method Detail

onAttachedToWindow

protected void onAttachedToWindow()

onApplyWindowInsets

public WindowInsets onApplyWindowInsets(WindowInsets insets)

addView

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

onFinishInflate

protected void onFinishInflate()

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 - whether content will be allowed to expand
See Also:
setExpansionDirection(int)

isExpansionEnabled

public boolean isExpansionEnabled()
Indicates if expansion is enabled.

See Also:
CardFrame.isExpansionEnabled()

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

getExpansionFactor

public float getExpansionFactor()
Returns the current expansion factor for the contained CardFrame.

See Also:
CardFrame.getExpansionFactor()

setExpansionFactor

public void setExpansionFactor(float expansionFactor)
Changes the expansion factor for the contained CardFrame.

See Also:
CardFrame#setExpansionFactor()

getExpansionDirection

public int getExpansionDirection()
Returns the current expansion direction for the contained CardFrame.

See Also:
CardFrame.getExpansionDirection()

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.


getCardGravity

public int getCardGravity()
Returns the current layout gravity for contained card frame.

See Also:
setCardGravity(int)

canScrollHorizontally

public boolean canScrollHorizontally(int direction)

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

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)

onLayout

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