Google 致力于为黑人社区推动种族平等。查看具体举措

DismissibleFrameLayout

public class DismissibleFrameLayout
extends FrameLayout

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ androidx.wear.widget.DismissibleFrameLayout


Special FrameLayout that is dismissible by the Back button press, and by left to right swipe when the SwipeToDismiss is been enabled on the device config or themes.

Summary

Nested classes

class DismissibleFrameLayout.Callback

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

Inherited constants

Inherited fields

Public constructors

DismissibleFrameLayout(Context context)

Simple constructor to use when creating a view from code.

DismissibleFrameLayout(Context context, AttributeSet attrs)

Constructor that is called when inflating a view from XML.

DismissibleFrameLayout(Context context, AttributeSet attrs, int defStyle)

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

DismissibleFrameLayout(Context context, AttributeSet attrs, int defStyle, int defStyleRes)

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

Public methods

boolean canScrollHorizontally(int direction)
boolean isBackButtonDismissible()

Returns true if the frame layout would be dismissed with back button click

boolean isSwipeDismissible()

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

boolean onInterceptTouchEvent(MotionEvent ev)
boolean onTouchEvent(MotionEvent ev)
void registerCallback(DismissibleFrameLayout.Callback callback)

Registers a callback for dismissal.

void requestDisallowInterceptTouchEvent(boolean disallowIntercept)

Following methods overriding are only required with swipe-to-dismiss to handle touch event for detect swipe gesture.

void setBackButtonDismissible(boolean backButtonDismissible)

Sets the frame layout to be back button dismissible or not.

void setSwipeDismissible(boolean swipeDismissible)

Sets the frame layout to be swipe dismissible or not.

void unregisterCallback(DismissibleFrameLayout.Callback callback)

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

Protected methods

void executeDismissCanceledCallbacks()
void executeDismissStartedCallbacks()
void executeDismissedCallbacks()

Inherited methods