且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

自定义上下文菜单,如pinterest菜单

更新时间:2023-08-31 21:54:10

我认为不是上下文菜单,您可以根据需要使用 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