It is just a simple popop. You can do it on any presentation. Throw away the icon in the view, for example, the icone overflow menu and install a click listener on it.
This example provides a list of devices (smartphones) in the directory. I fill the tag with an object, so I know which user is clicking on.
public void showDeviceMenu(View v) { PopupMenu popup = new PopupMenu(this, v); popup.inflate(R.menu.cart_device_menu); DeviceTag tag = (DeviceTag) v.getTag(); final String groupId = tag.groupId; final String sku = tag.sku; final String productId = tag.productId; SpannableStringBuilder text = new SpannableStringBuilder(tag.name); text.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); popup.getMenu().findItem(R.id.menu_name).setTitle(text); invalidateOptionsMenu(); popup.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.duplicate_device: duplicateDevice(sku, productId); return true; case R.id.update_device: updateWirelessItemInCart(sku,groupId); return true; case R.id.delete_device: removeItemFromCart(groupId); return true; default: return false; } } }); popup.show(); }
source share