AppCompat v7 Toolbar onOptionsItemSelected not called

前端 未结 6 1788
感动是毒
感动是毒 2020-12-14 00:15

I changed from the original ActionBar to the AppCompat Toolbar and setSupportActionBar(toolbar). When I am using getSupportActionBar() and setDisplayHomeAsUpEnabled(true) fo

6条回答
  •  庸人自扰
    2020-12-14 00:43

    One thing that wasn't mentioned:
    If you build the options menu dynamically in onCreateOptionsMenu and return null there, the up button in the action bar will not work.
    Works fine if you return the Menu parameter without adding anything into it.

    Tested on emulator API 19

提交回复
热议问题