Show menu when view is long pressed

Ask by : justin.saliba November 13, 2012 09:10

I've been looking around on the internet regarding my question but I couldn't find a straight answer. Is it possible to create a non-blocking menu similar to the overflow menu found in Android 4.0+ when a view is long pressed?

I have a number of LinearLayout instances which have an OnLongClickListener which brings up a context menu, but it's not exactly what I am looking for. I was hoping for a smoother menu which is brought up when one of these instances is clicked, and removed when the user clicks outside of the menu's region. This is very similar to the way the overflow menu behaves in the Android ActionBar.

So to sum up, is it possible to replicate the look-and-fell and the behavior of the overflow menu when using context menus?

Here's hoping I don't have to jump through hoops to get the implementation that I desire.

Thanks in advance.

EDIT: After some digging I've found the PopupMenu which is exactly what I was looking for however it works only on devices running Honeycomb and above. Does anyone know of a way with which I can replicate this menu behavior in older versions of Android without using blocking windows like dialogs?

View original question

Answer by : Anup CowkurNovember 13, 2012 09:10