How to open the options menu programmatically?

前端 未结 11 1602
时光说笑
时光说笑 2020-11-28 06:47

I would like to open the optionsMenu programmatically without a click on the menu key from the user. How would I do that?

11条回答
  •  自闭症患者
    2020-11-28 07:17

    For developers using the new Toolbar class of the Support Library, this is how it's done:

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.showOverflowMenu();
    

提交回复
热议问题