tryShow

open fun tryShow(): Boolean(source)

Attempts to show the popup anchored to the view specified by setAnchorView.

Return

true if the popup was shown or was already showing prior to calling this method, false otherwise


open fun tryShow(x: Int, y: Int): Boolean(source)

Shows the popup menu and makes a best-effort to anchor it to the specified (x,y) coordinate relative to the anchor view.

Additionally, the popup's transition epicenter (see setEpicenterBounds will be centered on the specified coordinate, rather than using the bounds of the anchor view.

If the popup's resolved gravity is LEFT, this will display the popup with its top-left corner at (x,y) relative to the anchor view. If the resolved gravity is RIGHT, the popup's top-right corner will be at (x,y).

If the popup cannot be displayed fully on-screen, this method will attempt to scroll the anchor view's ancestors and/or offset the popup such that it may be displayed fully on-screen.

Return

true if the popup was shown or was already showing prior to calling this method, false otherwise

Parameters

x

x coordinate relative to the anchor view

y

y coordinate relative to the anchor view