Android 12 Developer Preview is here! Try it out, and give us your feedback!

SwipeDismissFrameLayout

@UiThread open class SwipeDismissFrameLayout : DismissibleFrameLayout
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ androidx.wear.widget.DismissibleFrameLayout
   ↳ androidx.wear.widget.SwipeDismissFrameLayout

A layout enabling left-to-right swipe-to-dismiss, intended for use within an activity.

At least one listener must be added to act on a dismissal action. A listener will typically remove a containing view or fragment from the current activity.

To suppress a swipe-dismiss gesture, at least one contained view must be scrollable, indicating that it would like to consume any horizontal touch gestures in that direction. In this case this view will only allow swipe-to-dismiss on the very edge of the left-hand-side of the screen. If you wish to entirely disable the swipe-to-dismiss gesture, setSwipeable(boolean) can be used for more direct control over the feature.

Summary

Nested classes
abstract

Implement this callback to act on particular stages of the dismissal.

Constants
static Float

Public constructors
<init>(context: Context!)

Simple constructor to use when creating a view from code.

<init>(context: Context!, attrs: AttributeSet!)

Constructor that is called when inflating a view from XML.

<init>(context: Context!, attrs: AttributeSet!, defStyle: Int)

Perform inflation from XML and apply a class-specific base style from a theme attribute.

<init>(context: Context!, attrs: AttributeSet!, defStyle: Int, defStyleRes: Int)

Perform inflation from XML and apply a class-specific base style from a theme attribute.

Public methods
open Unit

Adds a callback for dismissal.

open Float

Gets the minimum ratio of the screen after which the swipe gesture is treated as swipe-to-dismiss.

open Boolean

Returns true if the frame layout can be dismissed by swipe gestures.

open Unit

Removes a callback that was added with addCallback(Callback).

open Unit

Sets the minimum ratio of the screen after which the swipe gesture is treated as swipe-to-dismiss.

open Unit
setSwipeable(swipeable: Boolean)

Set the layout to be dismissible by swipe or not.

Protected methods
open Unit

open Unit

open Unit

Inherited functions