app:showAsAction ifRoom is not working on appcompat action bar

前端 未结 6 1992
我寻月下人不归
我寻月下人不归 2020-12-19 04:59

I have an action bar with the following menu items;



        
6条回答
  •  伪装坚强ぢ
    2020-12-19 05:37

    In case someone else gets into the same problem - I could not get the button to show up until I overrode the onCreateOptionsMenu function and Inflated the menu (I am using com.android.support:appcompat-v7:24.2.1 version)

    Here is the code snippet:

     @Override
        public boolean onCreateOptionsMenu (Menu menu){
    
            getMenuInflater().inflate(R.menu.toolbar_menu, menu);
            return super.onCreateOptionsMenu(menu);
        }
    

提交回复
热议问题