您只需单击适配器内的3dots图像即可显示弹出菜单
代码:
//Creating the instance of PopupMenu
final PopupMenu popup = new PopupMenu(activity, level);
//Inflating the Popup using xml file
popup.getMenuInflater().inflate(R.menu.popup_level, popup.getMenu());
//registering popup with OnMenuItemClickListener
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
level.setText(item.getTitle());
return true;
}
});
menuImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popup.show();//showing popup menu
}
});
tutorial here