How to make this kind of menu for recycleview Item . This is mainly a drop down menu to do action for that particulate item.
Asked
Active
Viewed 1,166 times
0
-
use overflow popup menu for this – H Raval Mar 23 '16 at 05:24
-
you can add an imageview in the layout that you are using – Aniruddha K.M Mar 23 '16 at 05:27
1 Answers
2
Use the three dot menu view as ImageView
in your RecyclerView
Item.
onClick of that ImageView open the popup menu.
sample code is here.
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final PopupMenu popupMenu = new PopupMenu(context, v);
final Menu menu = popupMenu.getMenu();
popupMenu.getMenuInflater().inflate(R.menu.menu_item_action, menu);
popupMenu.setOnMenuItemClickListener(onMenuItemClickListener);
switch (Global.listMode) {
case Global.LIST_STYLE_NORMAL: {
menu.findItem(R.id.action_delete).setVisible(false);
break;
}
case Global.LIST_STYLE_FAVORITE: {
menu.findItem(R.id.action_add_to_favorite).setVisible(false);
break;
}
case Global.LIST_STYLE_WATCH_LIST: {
menu.findItem(R.id.action_add_to_watch_list).setVisible(false);
break;
}
case Global.LIST_STYLE_DOWNLOAD: {
menu.findItem(R.id.action_download).setVisible(false);
break;
}
}
itemPosition = (int) view.getTag(R.id.tag_item_position);
popupMenu.show();
}
});

Maheshwar Ligade
- 6,709
- 4
- 42
- 59