自定义上下文菜单,如pinterest菜单 [英] Customise context menu like pinterest menu

查看:110
本文介绍了自定义上下文菜单,如pinterest菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当按下 GridView 中的项目时,我一直在寻找类似Pinterest菜单的东西。我知道这是一个太宽泛的问题。但是很少有人质疑会提供实现这些目标的正确方法。

I've been looking for something like Pinterest menu whenever item in GridView is pressed. I know it's too broad question. But little strike on question will provide a correct way to achieve these.

队列:

如何在GridView项目上实现自定义上下文菜单,例如Contacts +或Pinterest上下文菜单?

< img src = https://i.stack.imgur.com/d3REX.jpg alt = Pinterest上下文菜单>

尝试过:

ArcMenu :但是它们代替了Slider Menu或Popup Menu来用于整个应用程序。 我想要可以在GridView项上即时创建的菜单。

ArcMenu : But they are replacement of Slider Menu or Pop up Menu for overall Application. I want menu which can be created onFly for GridView Item.

卫星菜单:与ArcMenu相同,替换了Slider Menu或弹出菜单以用于整个应用程序。

Satellite Menu : Same as ArcMenu, replacement of Slider Menu or Pop up Menu for overall Application.

请启发我实现此类行为。

Please enlighten me to achieve behaviour like these.

推荐答案

我认为不是上下文菜单,您可以根据需要使用 PopupWindow

I think instead of Context Menu you can use PopupWindow for your requirement.

 //Custom popup view
View view= layoutInflater.inflate(R.layout.popupview, null);  
PopupWindow popupWindow = new PopupWindow(
               view, 
               LayoutParams.WRAP_CONTENT,  
                     LayoutParams.WRAP_CONTENT);

//Display popup window on clicking anything
//Displays pop up window near button with offsets 10 and -10
popupWindow.showAsDropDown(button, 10, -10);

更多信息

http://developer.android.com/reference/android/widget/PopupWindow.html

http://android-er.blogspot.in/2012/03/example-of-using-popupwindow.html

这篇关于自定义上下文菜单,如pinterest菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆