我使用以下代码显示弹出菜单
PopupMenu popupMenu = new PopupMenu(MainActivity.this, v);
popupMenu.getMenuInflater().inflate(R.menu.popupmenu, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Toast.makeText(MainActivity.this,
item.toString(),
Toast.LENGTH_LONG).show();
return true;
}
});
popupMenu.show();
}
但菜单覆盖了我的很多屏幕区域。如何指定弹出菜单的大小?
答案 0 :(得分:-1)
您必须创建自定义对话框。请参阅官方文档,了解如何在此处执行此操作:
https://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog