how to keep an options menu always on the screen

2019-06-20 20:07发布

I need the options menu to be displayed on screen always.. I've written the code to open options menu on the startup of an activity..

@Override
    public void onAttachedToWindow() {
        openOptionsMenu(); 
    };

But on clicking on another item on the screen, the menu goes down.. I want the menu to be on screen always.. Is there any way to do that?

1条回答
够拽才男人
2楼-- · 2019-06-20 20:20

Please try the following code:

@Override
public void onOptionsMenuClosed(Menu menu) {
openOptionsMenu();
}
查看更多
登录 后发表回答