WearableFrameLayout

public class WearableFrameLayout
extends ViewGroup

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


This class is deprecated.
starting with API 23 the sdk supports "round" and "notround" configuration qualifiers which are preferred. For more information about configuration qualifiers, see https://developer.android.com/guide/topics/resources/providing-resources.html

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.

Summary

Nested classes

class WearableFrameLayout.LayoutParams

This class is deprecated. starting with API 23 the sdk supports "round" and "notround" configuration qualifiers which are preferred. For more information about configuration qualifiers, see https://developer.android.com/guide/topics/resources/providing-resources.html  

Inherited constants

Inherited fields

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 setForegroundTintList(ColorStateList)} to the foreground drawable.

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.MATCH_PARENT, and a height of ViewGroup.LayoutParams.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

Public constructors

WearableFrameLayout

public WearableFrameLayout (Context context)

Parameters
context Context

WearableFrameLayout

public WearableFrameLayout (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

WearableFrameLayout

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

Parameters
context Context

attrs AttributeSet

defStyleAttr int

WearableFrameLayout

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

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

Public methods

draw

public void draw (Canvas canvas)

Parameters
canvas Canvas

drawableHotspotChanged

public void drawableHotspotChanged (float x, 
                float y)

Parameters
x float

y float

generateLayoutParams

public WearableFrameLayout.LayoutParams generateLayoutParams (AttributeSet attrs)

Parameters
attrs AttributeSet

Returns
WearableFrameLayout.LayoutParams

getForeground

public 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.

getForegroundGravity

public int getForegroundGravity ()

Describes how the foreground is positioned.

Returns
int foreground gravity.

getForegroundTintList

public ColorStateList getForegroundTintList ()

Returns
ColorStateList the tint applied to the foreground drawable

getForegroundTintMode

public PorterDuff.Mode getForegroundTintMode ()

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

getMeasureAllChildren

public 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.

jumpDrawablesToCurrentState

public void jumpDrawablesToCurrentState ()

onApplyWindowInsets

public WindowInsets onApplyWindowInsets (WindowInsets insets)

Parameters
insets WindowInsets

Returns
WindowInsets

onInitializeAccessibilityEvent

public void onInitializeAccessibilityEvent (AccessibilityEvent event)

Parameters
event AccessibilityEvent

onInitializeAccessibilityNodeInfo

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

Parameters
info AccessibilityNodeInfo

setForeground

public 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.

setForegroundGravity

public void setForegroundGravity (int foregroundGravity)

Describes how the foreground is positioned. Defaults to START and TOP.

Parameters
foregroundGravity int: See Gravity

setForegroundInPadding

public void setForegroundInPadding (boolean value)

Sets whether foreground should be in padding. True by default.

Parameters
value boolean

setForegroundTintList

public void setForegroundTintList (ColorStateList tint)

Applies a tint to the foreground drawable. Does not modify the current tint mode, which is PorterDuff.Mode.SRC_IN by default.

Subsequent calls to setForeground(Drawable) will automatically mutate the drawable and apply the specified tint and tint mode using Drawable.setTintList(ColorStateList).

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

setForegroundTintMode

public 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 PorterDuff.Mode.SRC_IN.

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

setMeasureAllChildren

public 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.

setVisibility

public void setVisibility (int visibility)

Parameters
visibility int

shouldDelayChildPressedState

public boolean shouldDelayChildPressedState ()

Returns
boolean

Protected methods

checkLayoutParams

protected boolean checkLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams

Returns
boolean

drawableStateChanged

protected void drawableStateChanged ()

generateDefaultLayoutParams

protected WearableFrameLayout.LayoutParams generateDefaultLayoutParams ()

Returns a set of layout parameters with a width of ViewGroup.LayoutParams.MATCH_PARENT, and a height of ViewGroup.LayoutParams.MATCH_PARENT.

Returns
WearableFrameLayout.LayoutParams

generateLayoutParams

protected ViewGroup.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

Parameters
p ViewGroup.LayoutParams

Returns
ViewGroup.LayoutParams

measureChildWithMargins

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

Parameters
child View

parentWidthMeasureSpec int

widthUsed int

parentHeightMeasureSpec int

heightUsed int

onAttachedToWindow

protected void onAttachedToWindow ()

onLayout

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

Parameters
changed boolean

left int

top int

right int

bottom int

onMeasure

protected void onMeasure (int widthMeasureSpec, 
                int heightMeasureSpec)

Parameters
widthMeasureSpec int

heightMeasureSpec int

onSizeChanged

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

Parameters
w int

h int

oldw int

oldh int

verifyDrawable

protected boolean verifyDrawable (Drawable who)

Parameters
who Drawable

Returns
boolean