2012-12-03 96 views
1

我使用下面的代碼顯示彈出菜單寬度彈出菜單 - 如何改變

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(); 
        } 

但菜單覆蓋了很多我的屏幕面積。如何指定彈出菜單的大小?

回答