弹出窗口在显示时折叠appbarlayout

时间:2016-12-22 02:28:34

标签: android popupmenu

我正在尝试使用片段中的溢出按钮显示弹出窗口。代码如下

 @Override
        public void onClick(View view) {

                PopupMenu popup = new PopupMenu(context, view);
                MenuInflater inflater = popup.getMenuInflater();
                inflater.inflate(R.menu.menu_now_plying, popup.getMenu());
                popup.show();
        }

为什么它会折叠我的appbar布局?感谢帮助

1 个答案:

答案 0 :(得分:0)

使用它:    PopupMenu popupMenu = new PopupMenu(context, view, Gravity.RIGHT);