DismissOverlayView

public class DismissOverlayView
extends FrameLayout

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


This class is deprecated.
starting with Android Wear 2.0, long pressing to dismiss an app is no longer suggested for immersive activities.

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

Prior to Android Wear 2.0, 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

Inherited constants

Inherited fields

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.

Inherited methods

Public constructors

DismissOverlayView

public DismissOverlayView (Context context)

Parameters
context Context

DismissOverlayView

public DismissOverlayView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

DismissOverlayView

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

Parameters
context Context

attrs AttributeSet

defStyle int

Public methods

performClick

public boolean performClick ()

Returns
boolean

setIntroText

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.

Parameters
textResId int

setIntroText

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.

Parameters
str CharSequence

show

public void show ()

Show the exit button.

This should be called from a long-press listener.

showIntroIfNecessary

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.