Example usage for android.widget PopupMenu getDragToOpenListener

List of usage examples for android.widget PopupMenu getDragToOpenListener

Introduction

In this page you can find the example usage for android.widget PopupMenu getDragToOpenListener.

Prototype

public OnTouchListener getDragToOpenListener() 

Source Link

Document

Returns an OnTouchListener that can be added to the anchor view to implement drag-to-open behavior.

Usage

From source file:com.android.calculator3.Calculator2.java

private PopupMenu constructPopupMenu() {
    final PopupMenu popupMenu = new PopupMenu(this, mOverflowMenuButton);
    mOverflowMenuButton.setOnTouchListener(popupMenu.getDragToOpenListener());
    final Menu menu = popupMenu.getMenu();
    popupMenu.inflate(R.menu.menu);/*from   w  ww  .j a  v  a 2 s. co m*/
    popupMenu.setOnMenuItemClickListener(this);
    onPrepareOptionsMenu(menu);
    return popupMenu;
}