弹出菜单调整高度和宽度

时间:2014-02-12 04:55:37

标签: android popup

我想增加弹出菜单的宽度,当我点击菜单按钮时,它在角落里打开并且体积小,我想将它的大小从小到两端增加。

这是我的弹出菜单代码,

        ivmainmenu.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            PopupMenu popup = new PopupMenu(Home.this,ivmainmenu);
            popup.getMenuInflater().inflate(R.menu.popupmenu,popup.getMenu());

            popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    // TODO Auto-generated method stub

                    switch (item.getItemId()) {
                    case R.id.ourwork:

                        Intent intent = new Intent(Home.this,Ourwork.class);
                        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        startActivity(intent);

                        break;

                    case R.id.aboutus:

                        Intent intent2= new Intent(Home.this,Aboutus.class);
                        startActivity(intent2);

                        break;

                    case R.id.services:

                        Intent intent3= new Intent(Home.this,Services.class);
                        startActivity(intent3);
                        break;
                    case R.id.contact:

                        Intent intent4= new Intent(Home.this,Contact.class);
                        startActivity(intent4);
                        break;
                    }

                    return true;
                }
            });

            popup.show();
        }
    });

这是我的样子,

enter image description here

我希望它能够完整地在alfadesign徽标下面,它可能吗?

请帮我解决这些问题, 谢谢。

0 个答案:

没有答案