public class

DismissOverlayView

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

Class Overview

A view for implementing long-press-to-dismiss in an app.

DismissOverlayView should be added to your layout such that it draws full-screen and over all other views. To use it, set the intro text using setIntroText(CharSequence) and call showIntroIfNecessary() in your activity's onCreate (or your fragment's onCreateView). Then, use a GestureDetector in your activity to detect long press gestures; when one is found, call show() on your DismissOverlayView. DismissOverlayView takes care of all of the hiding, showing, and dismissal logic for you; setting its visibility or alpha may lead to unintended behavior.

Summary

[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
DismissOverlayView(Context context)
DismissOverlayView(Context context, AttributeSet attrs)
DismissOverlayView(Context context, AttributeSet attrs, int defStyle)
Public Methods
boolean performClick()
void setIntroText(int textResId)
Set the intro text.
void setIntroText(CharSequence str)
Set the intro text.
void show()
Show the exit button.
void showIntroIfNecessary()
Displays the intro overlay over your app if necessary.
[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 DismissOverlayView (Context context)

public DismissOverlayView (Context context, AttributeSet attrs)

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

Public Methods

public boolean performClick ()

public void setIntroText (int textResId)

Set the intro text. The intro text is the text displayed when the app is run for the first time, as an overlay on the rest of your app's content.

public void setIntroText (CharSequence str)

Set the intro text. The intro text is the text displayed when the app is run for the first time, as an overlay on the rest of your app's content.

public void show ()

Show the exit button. This should be called from a long-press listener.

public void showIntroIfNecessary ()

Displays the intro overlay over your app if necessary. This does nothing if no intro text has been set, or if this is not the first time showIntroIfNecessary is called for your app.