FileDocCategorySizeDatePackage
ListPopupWindowCompat.javaAPI DocAndroid 5.1 API3536Thu Mar 12 22:22:56 GMT 2015android.support.v4.widget

ListPopupWindowCompat

public class ListPopupWindowCompat extends Object
Helper for accessing features in ListPopupWindow introduced after API level 4 in a backwards compatible fashion.

Fields Summary
static final ListPopupWindowImpl
IMPL
Select the correct implementation to use for the current platform.
Constructors Summary
private ListPopupWindowCompat()

        final int version = android.os.Build.VERSION.SDK_INT;
        if (version >= 19) {
            IMPL = new KitKatListPopupWindowImpl();
        } else {
            IMPL = new BaseListPopupWindowImpl();
        }
    
        // This class is not publicly instantiable.
    
Methods Summary
public static android.view.View.OnTouchListenercreateDragToOpenListener(java.lang.Object listPopupWindow, android.view.View src)
On API {@link android.os.Build.VERSION_CODES#KITKAT} and higher, returns an {@link OnTouchListener} that can be added to the source view to implement drag-to-open behavior. Generally, the source view should be the same view that was passed to ListPopupWindow.setAnchorView(View).

When the listener is set on a view, touching that view and dragging outside of its bounds will open the popup window. Lifting will select the currently touched list item.

Example usage:

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

param
listPopupWindow the ListPopupWindow against which to invoke the method
param
src the view on which the resulting listener will be set
return
a touch listener that controls drag-to-open behavior, or null on unsupported APIs

        return IMPL.createDragToOpenListener(listPopupWindow, src);