Most visited

Recently visited

RecyclerView.SimpleOnItemTouchListener

public static class RecyclerView.SimpleOnItemTouchListener
extends Object implements RecyclerView.OnItemTouchListener

java.lang.Object
   ↳ android.support.v7.widget.RecyclerView.SimpleOnItemTouchListener


RecyclerView.OnItemTouchListener的实现,它具有空方法体和默认返回值。

如果您不需要覆盖所有方法,您可能更愿意扩展此类。 使用这个类的另一个好处是未来的兼容性。 由于接口可能会发生变化,我们将始终在此类上提供默认实现,以便在更新到支持库的新版本时,代码不会中断。

Summary

Public constructors

RecyclerView.SimpleOnItemTouchListener()

Public methods

boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e)

在RecyclerView本身或其子视图处理它们之前,默认观察和/或接管发送到RecyclerView的触摸事件。

void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept)

当RecyclerView的孩子不想让RecyclerView及其祖先用 onInterceptTouchEvent(MotionEvent)拦截触摸事件时 onInterceptTouchEvent(MotionEvent)

void onTouchEvent(RecyclerView rv, MotionEvent e)

将触摸事件作为手势的一部分进行处理,该手势通过先前调用 onInterceptTouchEvent(RecyclerView, MotionEvent)返回true onInterceptTouchEvent(RecyclerView, MotionEvent)

Inherited methods

From class java.lang.Object
From interface android.support.v7.widget.RecyclerView.OnItemTouchListener

Public constructors

RecyclerView.SimpleOnItemTouchListener

RecyclerView.SimpleOnItemTouchListener ()

Public methods

onInterceptTouchEvent

boolean onInterceptTouchEvent (RecyclerView rv, 
                MotionEvent e)

在RecyclerView本身或其子视图处理它们之前,默认观察和/或接管发送到RecyclerView的触摸事件。

每个附加的OnItemTouchListener的onInterceptTouchEvent方法将按照RecyclerView本身或子视图进行任何其他触摸处理之前添加每个侦听器的顺序运行。

Parameters
rv RecyclerView
e MotionEvent: MotionEvent describing the touch event. All coordinates are in the RecyclerView's coordinate system.
Returns
boolean true if this OnItemTouchListener wishes to begin intercepting touch events, false to continue with the current behavior and continue observing future events in the gesture.

onRequestDisallowInterceptTouchEvent

void onRequestDisallowInterceptTouchEvent (boolean disallowIntercept)

当RecyclerView的一个小孩不想让RecyclerView及其祖先用 onInterceptTouchEvent(MotionEvent)拦截触摸事件时 onInterceptTouchEvent(MotionEvent)

Parameters
disallowIntercept boolean: True if the child does not want the parent to intercept touch events.

onTouchEvent

void onTouchEvent (RecyclerView rv, 
                MotionEvent e)

将触摸事件作为手势的一部分进行处理,该手势通过先前调用 onInterceptTouchEvent(RecyclerView, MotionEvent)返回true onInterceptTouchEvent(RecyclerView, MotionEvent)

Parameters
rv RecyclerView
e MotionEvent: MotionEvent describing the touch event. All coordinates are in the RecyclerView's coordinate system.

Hooray!