Some test text!

Loading...
Guides
Quick menu

Customize quick menu in Android

QuickMenu is a convenient annotation popup menu that appears when a user long-presses on a blank space or on text contained in a PDFViewCtrl. It extends RelativeLayout and is a child view of PDFViewCtrl.

ActionMenu
Long-press on blank spacequick menu when long-press on blank space
Long-press on textquick menu when long-press on blank space
To learn more about each icon, see the icon cheat sheet .
To learn how to customize the quick menu, see the customize quick menu guide .

Quick menu events

A number of events may be raised when a user interacts with the quick menu. For example, events will be raised when the quick menu is shown, dismissed, or when a quick menu item is clicked. You can register a QuickMenuListener to listen to such events and implement custom behavior accordingly.

If your activity is using PdfViewCtrlTabHostFragment2 for viewing PDF files, you can set your listener by calling:

mPdfViewCtrlTabHostFragment.getCurrentPDFViewCtrlFragment()
    .addQuickMenuListener(new ToolManager.QuickMenuListener() {
        @Override
        public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
            int which = menuItem.getItemId();
            // Handle click event...
            // Return true to stop executing internal logic
            return true;
        }

        @Override
        public void onQuickMenuShown() {
            // Called when the quick menu is shown
        }

        @Override
        public void onQuickMenuDismissed() {
            // Called when the quick menu is dismissed
        }
    });

Or you can register the listener using the ToolManager by calling ToolManager.setQuickMenuListener:

mToolManager.setQuickMenuListener(new ToolManager.QuickMenuListener() {
    @Override
    public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
        int which = menuItem.getItemId();
        // Handle click event...
        // Return true to stop executing internal logic
        return true;
    }
    
    @Override
    public void onQuickMenuShown() {
          // Called when the quick menu is shown
    }
    
    @Override
    public void onQuickMenuDismissed() {
          // Called when the quick menu is dismissed
    }
});

Hide quick menu items

If there are tools that you would like to remove from the quick menu, you can hide them by calling ToolManager.disableToolMode:

// Disable TextSquigglyCreate tool, TextStrikeoutCreate tool
mToolManager.disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.TEXT_SQUIGGLY,
    ToolManager.ToolMode.TEXT_STRIKEOUT}
);

Then, when you long-press on text you will see:

quick menu image

ToolMode icon mapping table

IconToolMode
Rectangle imageRECT_CREATE
Ellipse imageOVAL_CREATE
Polyline imagePOLYLINE_CREATE
Polygon imagePOLYGON_CREATE
Cloud imageCLOUD_CREATE
Line imageLINE_CREATE
Arrow imageARROW_CREATE
Ruler imageRULER_CREATE
Free text imageTEXT_CREATE
Callout imageCALLOUT_CREATE
Note imageTEXT_ANNOT_CREATE
Ink imageINK_CREATE
Eraser imageINK_ERASER
Signature imageSIGNATURE
Stamp imageSTAMPER
Rubber stamp imageRUBBER_STAMPER
Free highlighter imageFREE_HIGHLIGHTER
Highlight imageTEXT_HIGHLIGHT
Underline imageTEXT_UNDERLINE
Squiggly imageTEXT_SQUIGGLY
Strikeout imageTEXT_STRIKEOUT
Sound imageSOUND_CREATE
File attachment imageFILE_ATTACHMENT_CREATE
Text field imageFORM_TEXT_FIELD_CREATE
Checkbox field imageFORM_CHECKBOX_CREATE
Group select imageANNOT_EDIT_RECT_GROUP

Disable quick menu

If you would like to hide the long press quick menu entirely, you can do so by calling ToolManager.setDisableQuickMenu. For example:

mToolManager.setDisableQuickMenu(true);

Get the answers you need: Support

UPCOMING WEBINAR: Live tech update and run-through. October 21 @ 11am PDT