public
class
WearableFrameLayout
extends ViewGroup
java.lang.Object | |||
↳ | android.view.View | ||
↳ | android.view.ViewGroup | ||
↳ | android.support.wearable.view.WearableFrameLayout |
WearableFrameLayout works exactly like FrameLayout, except it can have overrides for a round screen. Besides using normal FrameLayout.LayoutParams attributes in your layout, you can also use *Round overrides, that will be applied instead if the device has a round screen. For example:
<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.
Nested classes | |
---|---|
class |
WearableFrameLayout.LayoutParams
Per-child layout information for layouts on wearable devices. |
Inherited constants |
---|
![]()
android.view.ViewGroup
|
![]()
android.view.View
|
Inherited fields |
---|
![]()
android.view.ViewGroup
|
![]()
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()
Returns the drawable used as the foreground of this FrameLayout. |
int
|
getForegroundGravity()
Describes how the foreground is positioned. |
ColorStateList
|
getForegroundTintList()
|
PorterDuff.Mode
|
getForegroundTintMode()
|
boolean
|
getMeasureAllChildren()
Determines whether all children, or just those in the VISIBLE or INVISIBLE state, are considered when measuring. |
void
|
jumpDrawablesToCurrentState()
|
WindowInsets
|
onApplyWindowInsets(WindowInsets insets)
|
void
|
onInitializeAccessibilityEvent(AccessibilityEvent event)
|
void
|
onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
|
void
|
setForeground(Drawable d)
Supply a Drawable that is to be rendered on top of all of the child views in the frame layout. |
void
|
setForegroundGravity(int foregroundGravity)
Describes how the foreground is positioned. |
void
|
setForegroundInPadding(boolean value)
Sets whether foreground should be in padding. |
void
|
setForegroundTintList(ColorStateList tint)
Applies a tint to the foreground drawable. |
void
|
setForegroundTintMode(PorterDuff.Mode tintMode)
Specifies the blending mode used to apply the tint specified by
|
void
|
setMeasureAllChildren(boolean measureAll)
Sets whether to consider all children, or just those in the VISIBLE or INVISIBLE state, when measuring. |
void
|
setVisibility(int visibility)
|
boolean
|
shouldDelayChildPressedState()
|
Protected methods | |
---|---|
boolean
|
checkLayoutParams(ViewGroup.LayoutParams p)
|
void
|
drawableStateChanged()
|
WearableFrameLayout.LayoutParams
|
generateDefaultLayoutParams()
Returns a set of layout parameters with a width of
|
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)
|
WearableFrameLayout (Context context)
Parameters | |
---|---|
context |
Context
|
WearableFrameLayout (Context context, AttributeSet attrs)
Parameters | |
---|---|
context |
Context
|
attrs |
AttributeSet
|
WearableFrameLayout (Context context, AttributeSet attrs, int defStyleAttr)
Parameters | |
---|---|
context |
Context
|
attrs |
AttributeSet
|
defStyleAttr |
int
|
WearableFrameLayout (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Parameters | |
---|---|
context |
Context
|
attrs |
AttributeSet
|
defStyleAttr |
int
|
defStyleRes |
int
|
void draw (Canvas canvas)
Parameters | |
---|---|
canvas |
Canvas
|
void drawableHotspotChanged (float x, float y)
Parameters | |
---|---|
x |
float
|
y |
float
|
WearableFrameLayout.LayoutParams generateLayoutParams (AttributeSet attrs)
Parameters | |
---|---|
attrs |
AttributeSet
|
Returns | |
---|---|
WearableFrameLayout.LayoutParams |
Drawable getForeground ()
Returns the drawable used as the foreground of this FrameLayout. The foreground drawable, if non-null, is always drawn on top of the children.
Returns | |
---|---|
Drawable |
A Drawable or null if no foreground was set. |
int getForegroundGravity ()
Describes how the foreground is positioned.
Returns | |
---|---|
int |
foreground gravity. |
See also:
ColorStateList getForegroundTintList ()
Returns | |
---|---|
ColorStateList |
the tint applied to the foreground drawable |
See also:
PorterDuff.Mode getForegroundTintMode ()
Returns | |
---|---|
PorterDuff.Mode |
the blending mode used to apply the tint to the foreground drawable |
See also:
boolean getMeasureAllChildren ()
Determines whether all children, or just those in the VISIBLE or INVISIBLE state, are considered when measuring.
Returns | |
---|---|
boolean |
Whether all children are considered when measuring. |
void jumpDrawablesToCurrentState ()
WindowInsets onApplyWindowInsets (WindowInsets insets)
Parameters | |
---|---|
insets |
WindowInsets
|
Returns | |
---|---|
WindowInsets |
void onInitializeAccessibilityEvent (AccessibilityEvent event)
Parameters | |
---|---|
event |
AccessibilityEvent
|
void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)
Parameters | |
---|---|
info |
AccessibilityNodeInfo
|
void setForeground (Drawable d)
Supply a Drawable that is to be rendered on top of all of the child views in the frame layout. Any padding in the Drawable will be taken into account by ensuring that the children are inset to be placed inside of the padding area.
Parameters | |
---|---|
d |
Drawable :
The Drawable to be drawn on top of the children.
|
void setForegroundGravity (int foregroundGravity)
Describes how the foreground is positioned. Defaults to START and TOP.
Parameters | |
---|---|
foregroundGravity |
int :
See Gravity |
See also:
void setForegroundInPadding (boolean value)
Sets whether foreground should be in padding. True by default.
Parameters | |
---|---|
value |
boolean
|
void setForegroundTintList (ColorStateList tint)
Applies a tint to the foreground drawable. Does not modify the current
tint mode, which is SRC_IN
by default.
Subsequent calls to setForeground(Drawable)
will automatically
mutate the drawable and apply the specified tint and tint mode using
setTintList(ColorStateList)
.
Parameters | |
---|---|
tint |
ColorStateList :
the tint to apply, may be null to clear tint |
void setForegroundTintMode (PorterDuff.Mode tintMode)
Specifies the blending mode used to apply the tint specified by
setForegroundTintList(ColorStateList)
} to the foreground drawable.
The default mode is SRC_IN
.
Parameters | |
---|---|
tintMode |
PorterDuff.Mode :
the blending mode used to apply the tint, may be
null to clear tint |
void setMeasureAllChildren (boolean measureAll)
Sets whether to consider all children, or just those in the VISIBLE or INVISIBLE state, when measuring. Defaults to false.
Parameters | |
---|---|
measureAll |
boolean :
true to consider children marked GONE, false otherwise.
Default value is false.
|
void setVisibility (int visibility)
Parameters | |
---|---|
visibility |
int
|
boolean shouldDelayChildPressedState ()
Returns | |
---|---|
boolean |
boolean checkLayoutParams (ViewGroup.LayoutParams p)
Parameters | |
---|---|
p |
ViewGroup.LayoutParams
|
Returns | |
---|---|
boolean |
void drawableStateChanged ()
WearableFrameLayout.LayoutParams generateDefaultLayoutParams ()
Returns a set of layout parameters with a width of
MATCH_PARENT
,
and a height of MATCH_PARENT
.
Returns | |
---|---|
WearableFrameLayout.LayoutParams |
ViewGroup.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)
Parameters | |
---|---|
p |
ViewGroup.LayoutParams
|
Returns | |
---|---|
ViewGroup.LayoutParams |
void measureChildWithMargins (View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed)
Parameters | |
---|---|
child |
View
|
parentWidthMeasureSpec |
int
|
widthUsed |
int
|
parentHeightMeasureSpec |
int
|
heightUsed |
int
|
void onAttachedToWindow ()
void onLayout (boolean changed, int left, int top, int right, int bottom)
Parameters | |
---|---|
changed |
boolean
|
left |
int
|
top |
int
|
right |
int
|
bottom |
int
|
void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
Parameters | |
---|---|
widthMeasureSpec |
int
|
heightMeasureSpec |
int
|
void onSizeChanged (int w, int h, int oldw, int oldh)
Parameters | |
---|---|
w |
int
|
h |
int
|
oldw |
int
|
oldh |
int
|
boolean verifyDrawable (Drawable who)
Parameters | |
---|---|
who |
Drawable
|
Returns | |
---|---|
boolean |