How to force use of overflow menu on devices with menu button

前端 未结 11 546
谎友^
谎友^ 2020-11-22 14:04

I\'d like to have all of the menu items that don\'t fit into the ActionBar go into the overflow menu (the one that is reached from the Action Bar not the menu button) ev

11条回答
  •  粉色の甜心
    2020-11-22 14:15

    Sorry if this problem is dead.

    Here is what I did to resolve the error. I went to layouts and created two ones containing toolbars. One was a layout for sdk version 8 and the other was for sdk version 21. On version 8, I used the android.support.v7.widget.Toolbar while I used android.widget.Toolbar on the sdk 21 layout.

    Then I inflate the toolbar in my activity. I check the sdk to see if it was 21 or higher. I then inflate the corresponding layout. This forces the hardware button to map onto the toolbar you actually designed.

提交回复
热议问题