public class

WatchViewStub

extends FrameLayout

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.widget.FrameLayout
         ↳ android.support.wearable.view.WatchViewStub

Class Overview

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. 
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
WatchViewStub(Context context)
WatchViewStub(Context context, AttributeSet attrs)
WatchViewStub(Context context, AttributeSet attrs, int defStyle)
Public Methods
void inflate()
Inflate the appropriate child layout for the last known container.
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)
[Expand]
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

public WatchViewStub (Context context)

public WatchViewStub (Context context, AttributeSet attrs)

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

Public Methods

public void inflate ()

Inflate the appropriate child layout for the last known container.

public WindowInsets onApplyWindowInsets (WindowInsets insets)

public void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

public 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 Listener to notify

public void setRectLayout (int resId)

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

Parameters
resId Resource id of a child layout to inflate

public void setRoundLayout (int resId)

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

Parameters
resId Resource id of a child layout to inflate

Protected Methods

protected void onAttachedToWindow ()

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