BoxInsetLayout

public class BoxInsetLayout
extends FrameLayout

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


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.

Summary

Nested classes

class BoxInsetLayout.LayoutParams

adds layout_box attribute to layout parameters  

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

BoxInsetLayout(Context context)
BoxInsetLayout(Context context, AttributeSet attrs)
BoxInsetLayout(Context context, AttributeSet attrs, int defStyle)

Public methods

BoxInsetLayout.LayoutParams generateLayoutParams(AttributeSet attrs)
Rect getInsets()
boolean isRound()

determine screen shape

WindowInsets onApplyWindowInsets(WindowInsets insets)
void setForeground(Drawable drawable)

Protected methods

boolean checkLayoutParams(ViewGroup.LayoutParams p)
ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
void onAttachedToWindow()
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

BoxInsetLayout

BoxInsetLayout (Context context)

Parameters
context Context

BoxInsetLayout

BoxInsetLayout (Context context,
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

BoxInsetLayout

BoxInsetLayout (Context context,
                AttributeSet attrs,
                int defStyle)

Parameters
context Context
attrs AttributeSet
defStyle int

Public methods

generateLayoutParams

BoxInsetLayout.LayoutParams generateLayoutParams (AttributeSet attrs)

Parameters
attrs AttributeSet
Returns
BoxInsetLayout.LayoutParams

getInsets

Rect getInsets ()

Returns
Rect the system window insets Rect

isRound

boolean isRound ()

determine screen shape

Returns
boolean true if on a round screen

onApplyWindowInsets

WindowInsets onApplyWindowInsets (WindowInsets insets)

Parameters
insets WindowInsets
Returns
WindowInsets

setForeground

void setForeground (Drawable drawable)

Parameters
drawable Drawable

Protected methods

checkLayoutParams

boolean checkLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams
Returns
boolean

generateLayoutParams

ViewGroup.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams
Returns
ViewGroup.LayoutParams

onAttachedToWindow

void onAttachedToWindow ()

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