WearableFrameLayout

public class WearableFrameLayout
extends ViewGroup

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.support.wearable.view.WearableFrameLayout


WearableFrameLayout的工作方式与FrameLayout完全相同,只是它可以覆盖圆形屏幕。 除了在布局中使用普通的FrameLayout.LayoutParams属性外,还可以使用* Round覆盖,如果设备具有圆形屏幕,则将应用该覆盖。 例如:


 <android.support.wearable.view.WearableFrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     >

     <ImageView
         android:id="@+id/preview"
         android:layout_height="@dimen/watch_face_entry_preview_width"
         android:layout_width="@dimen/watch_face_entry_preview_width"
         android:layout_marginTop="@dimen/watch_face_entry_preview_margin_top"
         app:layout_heightRound="@dimen/watch_face_entry_circular_preview_size"
         app:layout_widthRound="@dimen/watch_face_entry_circular_preview_size"
         app:layout_marginTopRound="@dimen/watch_face_entry_circular_preview_margin_top"
         app:layout_gravityRound="center_horizontal"
         />

 </android.support.wearable.view.WearableFrameLayout>
 
There might be subtle differences in behavior between FrameLayout and WearableFrameLayout, because this class doesn't have access to all hidden APIs that FrameLayout does. One example is setForeground, where Drawable parameter won't receive setLayoutDirection call.

Summary

Nested classes

class WearableFrameLayout.LayoutParams

可穿戴设备上布局的每个孩子的布局信息。

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

WearableFrameLayout(Context context)
WearableFrameLayout(Context context, AttributeSet attrs)
WearableFrameLayout(Context context, AttributeSet attrs, int defStyleAttr)
WearableFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public methods

void draw(Canvas canvas)

void drawableHotspotChanged(float x, float y)
WearableFrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs)

Drawable getForeground()

返回用作此FrameLayout前景的drawable。

int getForegroundGravity()

描述前景如何定位。

ColorStateList getForegroundTintList()
PorterDuff.Mode getForegroundTintMode()
boolean getMeasureAllChildren()

确定是否在测量时考虑所有的孩子,或者只是那些处于VISIBLE或INVISIBLE状态的孩子。

void jumpDrawablesToCurrentState()
WindowInsets onApplyWindowInsets(WindowInsets insets)
void onInitializeAccessibilityEvent(AccessibilityEvent event)
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
void setForeground(Drawable d)

提供要在框架布局中的所有子视图之上渲染的Drawable。

void setForegroundGravity(int foregroundGravity)

描述前景如何定位。

void setForegroundInPadding(boolean value)

设置前景是否应该填充。

void setForegroundTintList(ColorStateList tint)

将前景应用于可绘制的前景。

void setForegroundTintMode(PorterDuff.Mode tintMode)

指定用于将 setForegroundTintList(ColorStateList) }指定的色调应用于前景绘制的混合模式。

void setMeasureAllChildren(boolean measureAll)

测量时设置是否考虑所有儿童,或仅考虑处于VISIBLE或INVISIBLE状态的儿童。

void setVisibility(int visibility)
boolean shouldDelayChildPressedState()

Protected methods

boolean checkLayoutParams(ViewGroup.LayoutParams p)

void drawableStateChanged()

WearableFrameLayout.LayoutParams generateDefaultLayoutParams()

返回一组宽度为 MATCH_PARENT ,高度为 MATCH_PARENT的布局参数。

ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
void measureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed)
void onAttachedToWindow()
void onLayout(boolean changed, int left, int top, int right, int bottom)

void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

void onSizeChanged(int w, int h, int oldw, int oldh)

boolean verifyDrawable(Drawable who)

Inherited methods

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

WearableFrameLayout

WearableFrameLayout (Context context)

Parameters
context Context

WearableFrameLayout

WearableFrameLayout (Context context,
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

WearableFrameLayout

WearableFrameLayout (Context context,
                AttributeSet attrs,
                int defStyleAttr)

Parameters
context Context
attrs AttributeSet
defStyleAttr int

WearableFrameLayout

WearableFrameLayout (Context context,
                AttributeSet attrs,
                int defStyleAttr,
                int defStyleRes)

Parameters
context Context
attrs AttributeSet
defStyleAttr int
defStyleRes int

Public methods

draw

void draw (Canvas canvas)

Parameters
canvas Canvas

drawableHotspotChanged

void drawableHotspotChanged (float x,
                float y)

Parameters
x float
y float

generateLayoutParams

WearableFrameLayout.LayoutParams generateLayoutParams (AttributeSet attrs)

Parameters
attrs AttributeSet
Returns
WearableFrameLayout.LayoutParams

getForeground

Drawable getForeground ()

返回用作此FrameLayout前景的drawable。 可绘制的前景(如果非null)始终绘制在子项上。

Returns
Drawable A Drawable or null if no foreground was set.

getForegroundGravity

int getForegroundGravity ()

描述前景如何定位。

Returns
int foreground gravity.

也可以看看:

getForegroundTintList

ColorStateList getForegroundTintList ()

Returns
ColorStateList the tint applied to the foreground drawable

也可以看看:

getForegroundTintMode

PorterDuff.Mode getForegroundTintMode ()

Returns
PorterDuff.Mode the blending mode used to apply the tint to the foreground drawable

也可以看看:

getMeasureAllChildren

boolean getMeasureAllChildren ()

确定是否在测量时考虑所有的孩子,或者只是那些处于VISIBLE或INVISIBLE状态的孩子。

Returns
boolean Whether all children are considered when measuring.

jumpDrawablesToCurrentState

void jumpDrawablesToCurrentState ()

onApplyWindowInsets

WindowInsets onApplyWindowInsets (WindowInsets insets)

Parameters
insets WindowInsets
Returns
WindowInsets

onInitializeAccessibilityEvent

void onInitializeAccessibilityEvent (AccessibilityEvent event)

Parameters
event AccessibilityEvent

onInitializeAccessibilityNodeInfo

void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

Parameters
info AccessibilityNodeInfo

setForeground

void setForeground (Drawable d)

提供要在框架布局中的所有子视图之上渲染的Drawable。 通过确保孩子插入填充区域内,可以考虑Drawable中的任何填充。

Parameters
d Drawable: The Drawable to be drawn on top of the children.

setForegroundGravity

void setForegroundGravity (int foregroundGravity)

描述前景如何定位。 默认为START和TOP。

Parameters
foregroundGravity int: See Gravity

也可以看看:

setForegroundInPadding

void setForegroundInPadding (boolean value)

设置前景是否应该填充。 默认情况下为真。

Parameters
value boolean

setForegroundTintList

void setForegroundTintList (ColorStateList tint)

将前景应用于可绘制的前景。 不会修改当前着色模式,默认为SRC_IN

随后对 setForeground(Drawable)调用将自动改变drawable,并使用 setTintList(ColorStateList)应用指定的色调和色调模式。

Parameters
tint ColorStateList: the tint to apply, may be null to clear tint

也可以看看:

setForegroundTintMode

void setForegroundTintMode (PorterDuff.Mode tintMode)

指定用于将setForegroundTintList(ColorStateList) }指定的色调应用于前景绘制的混合模式。 默认模式是SRC_IN

Parameters
tintMode PorterDuff.Mode: the blending mode used to apply the tint, may be null to clear tint

也可以看看:

setMeasureAllChildren

void setMeasureAllChildren (boolean measureAll)

测量时设置是否考虑所有儿童,或仅考虑处于VISIBLE或INVISIBLE状态的儿童。 默认为false。

Parameters
measureAll boolean: true to consider children marked GONE, false otherwise. Default value is false.

setVisibility

void setVisibility (int visibility)

Parameters
visibility int

shouldDelayChildPressedState

boolean shouldDelayChildPressedState ()

Returns
boolean

Protected methods

checkLayoutParams

boolean checkLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams
Returns
boolean

drawableStateChanged

void drawableStateChanged ()

generateDefaultLayoutParams

WearableFrameLayout.LayoutParams generateDefaultLayoutParams ()

返回一组宽度为 MATCH_PARENT ,高度为 MATCH_PARENT的布局参数。

Returns
WearableFrameLayout.LayoutParams

generateLayoutParams

ViewGroup.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams
Returns
ViewGroup.LayoutParams

measureChildWithMargins

void measureChildWithMargins (View child,
                int parentWidthMeasureSpec,
                int widthUsed,
                int parentHeightMeasureSpec,
                int heightUsed)

Parameters
child View
parentWidthMeasureSpec int
widthUsed int
parentHeightMeasureSpec int
heightUsed int

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

onSizeChanged

void onSizeChanged (int w,
                int h,
                int oldw,
                int oldh)

Parameters
w int
h int
oldw int
oldh int

verifyDrawable

boolean verifyDrawable (Drawable who)

Parameters
who Drawable
Returns
boolean