Most visited

Recently visited

ListPopupWindowCompat

public final class ListPopupWindowCompat
extends Object

java.lang.Object
   ↳ android.support.v4.widget.ListPopupWindowCompat


Helper用于以向后兼容的方式访问API级别4后引入的ListPopupWindow中的功能。

Summary

Public methods

static View.OnTouchListener createDragToOpenListener(Object listPopupWindow, View src)

在API KITKAT及更高版本上,返回 View.OnTouchListener ,可将其添加到源视图以实现拖动打开行为。

Inherited methods

From class java.lang.Object

Public methods

createDragToOpenListener

View.OnTouchListener createDragToOpenListener (Object listPopupWindow, 
                View src)

在API KITKAT及更高版本上,返回View.OnTouchListener ,可将其添加到源视图以实现拖动打开行为。 通常,源视图应该是传递给ListPopupWindow.setAnchorView(View)的相同视图。

将侦听器设置在视图上时,触摸该视图并在其边界之外拖动将打开弹出窗口。 提升将选择当前触摸的列表项目。

用法示例:

 ListPopupWindow myPopup = new ListPopupWindow(context);
 myPopup.setAnchor(myAnchor);
 OnTouchListener dragListener = myPopup.createDragToOpenListener(myAnchor);
 myAnchor.setOnTouchListener(dragListener);
 

Parameters
listPopupWindow Object: the ListPopupWindow against which to invoke the method
src View: the view on which the resulting listener will be set
Returns
View.OnTouchListener a touch listener that controls drag-to-open behavior, or null on unsupported APIs

Hooray!