android.support.wearable.view
Class BoxInsetLayout

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

public class BoxInsetLayout
extends FrameLayout

BoxInsetLayout is a screen shape-aware FrameLayout that can box its children in the center square of a round screen by using the layout_box attribute. The values for this attribute specify the child's edges to be boxed in: left|top|right|bottom or all. The layout_box attribute is ignored on a device with a rectangular screen.


Nested Class Summary
static class BoxInsetLayout.LayoutParams
          adds layout_box attribute to layout parameters
 
Constructor Summary
BoxInsetLayout(Context context)
           
BoxInsetLayout(Context context, AttributeSet attrs)
           
BoxInsetLayout(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
protected  boolean checkLayoutParams(ViewGroup.LayoutParams p)
           
 BoxInsetLayout.LayoutParams generateLayoutParams(AttributeSet attrs)
           
protected  ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
           
 Rect getInsets()
           
 boolean isRound()
          determine screen shape
 WindowInsets onApplyWindowInsets(WindowInsets insets)
           
protected  void onAttachedToWindow()
           
protected  void onLayout(boolean changed, int left, int top, int right, int bottom)
           
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           
 void setForeground(Drawable drawable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoxInsetLayout

public BoxInsetLayout(Context context)

BoxInsetLayout

public BoxInsetLayout(Context context,
                      AttributeSet attrs)

BoxInsetLayout

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

onAttachedToWindow

protected void onAttachedToWindow()

onApplyWindowInsets

public WindowInsets onApplyWindowInsets(WindowInsets insets)

isRound

public boolean isRound()
determine screen shape

Returns:
true if on a round screen

getInsets

public Rect getInsets()
Returns:
the system window insets Rect

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)

onLayout

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

setForeground

public void setForeground(Drawable drawable)

checkLayoutParams

protected boolean checkLayoutParams(ViewGroup.LayoutParams p)

generateLayoutParams

protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)

generateLayoutParams

public BoxInsetLayout.LayoutParams generateLayoutParams(AttributeSet attrs)