Most visited

Recently visited

PopupMenuCompat

public final class PopupMenuCompat
extends Object

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


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

Summary

Public methods

static View.OnTouchListener getDragToOpenListener(Object popupMenu)

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

Inherited methods

From class java.lang.Object

Public methods

getDragToOpenListener

View.OnTouchListener getDragToOpenListener (Object popupMenu)

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

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

用法示例:

 PopupMenu myPopup = new PopupMenu(context, myAnchor);
 myAnchor.setOnTouchListener(myPopup.getDragToOpenListener());
 

Parameters
popupMenu Object: the PopupMenu against which to invoke the method
Returns
View.OnTouchListener a touch listener that controls drag-to-open behavior, or null on unsupported APIs

Hooray!