Android ActionBar compat overflow menu not showing on sdk 10

后端 未结 3 1314
被撕碎了的回忆
被撕碎了的回忆 2021-01-05 11:05

Hello and thank you for the time you take in reading this question.

I am trying to develop an android app which will use the ActionBar compat library. I have followe

3条回答
  •  悲&欢浪女
    2021-01-05 12:02

    Try to show as I did.

    I add overflow menu (three dots) manually:

    
        
            
        
    
    

    and override menu button click in activity to show this menu (solution from Opening submenu in action bar on Hardware menu button click):

    private Menu mainMenu;    
    
    ...
    
    @Override
        public boolean onKeyUp(int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_UP) {
                switch (keyCode) {
                case KeyEvent.KEYCODE_MENU:
    
                    mainMenu.performIdentifierAction(R.id.menu_more, 0);
                    return true;
                }
    
            }
            return super.onKeyUp(keyCode, event);
        }
    

    Result on 2.2 looks like:

    Android 2.2 Overflow menu

    Hope it helps you.

提交回复
热议问题