问题


Can anyone tell me what control or how do you create the pop-up effect used in these images to display the legend? The screenshots are taken from an app called FlyOKC. Any help is greatly appreciated, thank you.
回答1:
This is not exactly a custom dialog. But, yes it is still a customized view. And it is more or less called Quick Action Dialog in android. I would suggest you to follow the tutorials below for generating an exactly same popover (or even better) with Android. Check the screenshot also.
- http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
- http://www.androidpatterns.com/uap_pattern/quick-actions (Pattern Reference)

回答2:
That's certainly using a custom version of a dialog. The idea is to implement your layout in a xml and inflate it in a dialog. There's a lot of tutorials around, try that one.
回答3:
Actually, that can be achieved by using RelativeLayout and switching the legend view's visible state between View.VISIBLE and View.GONE in button's click handler.
To get the exact animation you'll need to jump some hoops. Here are related threads:
How does one Animate Layout properties of ViewGroups?
How do I animate View.setVisibility(GONE)
Also, I think another (and possibly easier) way would be to use Fragments API with transition effects, in which case this is the thread to read:
Animate the transition between fragments
来源:https://stackoverflow.com/questions/9131076/how-do-replicate-this-android-pop-up