public class

WearableFrameLayout

extends ViewGroup

Note: The Wearable Support Library classes under the android.support.wearable package are subject to change. For the full Android API reference, see Reference.

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

Class Overview

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 Per-child layout information for layouts on wearable devices. 
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
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()
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 MATCH_PARENT, and a height of 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)
[Expand]
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

public WearableFrameLayout (Context context)

public WearableFrameLayout (Context context, AttributeSet attrs)

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

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

Public Methods

public void draw (Canvas canvas)

public void drawableHotspotChanged (float x, float y)

public WearableFrameLayout.LayoutParams generateLayoutParams (AttributeSet attrs)

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
  • A Drawable or null if no foreground was set.

public int getForegroundGravity ()

Describes how the foreground is positioned.

Returns
  • foreground gravity.

public ColorStateList getForegroundTintList ()

Returns
  • the tint applied to the foreground drawable

public PorterDuff.Mode getForegroundTintMode ()

Returns
  • the blending mode used to apply the tint to the foreground drawable

public boolean getMeasureAllChildren ()

Determines whether all children, or just those in the VISIBLE or INVISIBLE state, are considered when measuring.

Returns
  • Whether all children are considered when measuring.

public void jumpDrawablesToCurrentState ()

public WindowInsets onApplyWindowInsets (WindowInsets insets)

public void onInitializeAccessibilityEvent (AccessibilityEvent event)

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

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 The Drawable to be drawn on top of the children.

public void setForegroundGravity (int foregroundGravity)

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

Parameters
foregroundGravity See Gravity

public void setForegroundInPadding (boolean value)

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

public 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 the tint to apply, may be null to clear tint

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

Parameters
tintMode the blending mode used to apply the tint, may be null to clear tint

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 true to consider children marked GONE, false otherwise. Default value is false.

public void setVisibility (int visibility)

public boolean shouldDelayChildPressedState ()

Protected Methods

protected boolean checkLayoutParams (ViewGroup.LayoutParams p)

protected void drawableStateChanged ()

protected WearableFrameLayout.LayoutParams generateDefaultLayoutParams ()

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

protected ViewGroup.LayoutParams generateLayoutParams (ViewGroup.LayoutParams p)

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

protected void onAttachedToWindow ()

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

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

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

protected boolean verifyDrawable (Drawable who)