BoxInsetLayout

public class BoxInsetLayout
extends FrameLayout

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


BoxInsetLayout是一种屏幕形状感知的FrameLayout,它可以通过使用layout_box属性将其子layout_box在圆形屏幕的中心方框中。 此属性的值指定要left|top|right|bottom的子边: left|top|right|bottomall 在具有矩形屏幕的设备上忽略layout_box属性。

Summary

Nested classes

class BoxInsetLayout.LayoutParams

layout_box属性添加到布局参数

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()

确定屏幕形状

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 ()

确定屏幕形状

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