Action Bar Icon hidden after SearchView expands

后端 未结 2 675
时光说笑
时光说笑 2021-02-13 11:32

\"When

\"When<

2条回答
  •  深忆病人
    2021-02-13 12:26

    try with this, works for me using appCompat v21

    final MenuItem switchButton = menu.findItem(R.id.action_import);
    final MenuItem searchItem = menu.findItem(R.id.action_search);
    
    MenuItemCompat.setShowAsAction(searchItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    MenuItemCompat.setShowAsAction(switchButton, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); 
    

提交回复
热议问题