Zaffar Saffee
Zaffar Saffee

Reputation: 6305

Andrioid Drawer Menu like custom menu on clickListener

I am working on a Google Maps V2 application, in which my MainActivity has a Fragment for Maps and a linear layout which holds this fragment. I also draw markers on the map. My idea is to create a menu like Drawermenu which will show custom Menu for that Clicked Marker..

I am a bit new to android, and so far, what I know is, I can implement a Drawer Menu for Complete application as a navigation (have read the documentation and a few articles on this and I can do it myself now).

My Question is, can I build a drawer menu which will be shown onMarkerClickListener ??

is that something possible??

is someone has done it already? any code example of SO or github??

any rough algo / code example / guideline is highly appreciated...

thanks for your help

Upvotes: 0

Views: 70

Answers (1)

Faisal Naseer
Faisal Naseer

Reputation: 4248

In order to prevent drawer from listening to gestures use.

final DrawerLayout drawer = (DrawerLayout) getActivity().findViewById(R.id.drawer_layout);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

and use openDrawer and closeDrawer to change menu visibility.

//and then use it in your onMarkerClickListener.
drawer.openDrawer(Your View, Usually a ListView);

and if you want to hide drawer use.

drawer.closeDrawer(Your View, Usually a ListView);

I hope this will help you :)

Upvotes: 1

Related Questions