WatchViewStub

public class WatchViewStub
extends FrameLayout

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


A WatchViewStub allows for the use of different sub-layouts depending on the shape of the device screen as reported by onApplyWindowInsets. If the call is not delivered by initial measurement the container will be assumed rectangular.

Summary

Nested classes

interface WatchViewStub.OnLayoutInflatedListener

Listener for detecting when internal layout inflation has completed. 

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

WatchViewStub(Context context)
WatchViewStub(Context context, AttributeSet attrs)
WatchViewStub(Context context, AttributeSet attrs, int defStyle)

Public methods

WindowInsets onApplyWindowInsets(WindowInsets insets)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void setOnLayoutInflatedListener(WatchViewStub.OnLayoutInflatedListener listener)

Set a listener to be notified when one of the specified sub-layouts is inflated into this stub container.

void setRectLayout(int resId)

Set a layout resource to be inflated when this stub is within a rectangular container.

void setRoundLayout(int resId)

Set a layout resource to be inflated when this stub is within a round container.

Protected methods

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

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

WatchViewStub

WatchViewStub (Context context)

Parameters
context Context

WatchViewStub

WatchViewStub (Context context,
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

WatchViewStub

WatchViewStub (Context context,
                AttributeSet attrs,
                int defStyle)

Parameters
context Context
attrs AttributeSet
defStyle int

Public methods

onApplyWindowInsets

WindowInsets onApplyWindowInsets (WindowInsets insets)

Parameters
insets WindowInsets
Returns
WindowInsets

onMeasure

void onMeasure (int widthMeasureSpec,
                int heightMeasureSpec)

Parameters
widthMeasureSpec int
heightMeasureSpec int

setOnLayoutInflatedListener

void setOnLayoutInflatedListener (WatchViewStub.OnLayoutInflatedListener listener)

Set a listener to be notified when one of the specified sub-layouts is inflated into this stub container.

If your app needs to perform a series of findViewById lookups on the final inflated layout this callback is a great time to do so.

Parameters
listener WatchViewStub.OnLayoutInflatedListener: Listener to notify

setRectLayout

void setRectLayout (int resId)

Set a layout resource to be inflated when this stub is within a rectangular container.

Parameters
resId int: Resource id of a child layout to inflate

setRoundLayout

void setRoundLayout (int resId)

Set a layout resource to be inflated when this stub is within a round container.

Parameters
resId int: Resource id of a child layout to inflate

Protected methods

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