androidandroid-popupwindow

Android - Pop up a View on top of another View


Suppose I have a Button like what is in the following:
A simple Button
I want once this button is clicked a ImageView(popup message) appears in the top of this button, something like this:
enter image description here

But I do not know how put a View as an overlay on top of another View, Just I know this can be achieved by FrameLayout . Please suppose I want to embed this capability into the Button (in the other phrases I want to create a custom button with a method called showPopup(...) like Textview's setError(...))
Can any one please help me? Thanks


Solution

  • How about taking a look at the Quick Action Dialog?

    It is an old article (We're talking Android 2.2 territory), but should still work for the latest devices and OS.

    The example uses a contextual popup with buttons, but should be easily modifiable to just show text or whatever you want. There is an example further in that shows use alongside a button.