Using support action bar home enabled

后端 未结 5 2242
花落未央
花落未央 2021-02-08 13:31

I\'ve just modified our code to use the new SupportActionBar provided in the v7-appcompat library but when running the code on a Jellybean phone (presumably the same problem exi

5条回答
  •  礼貌的吻别
    2021-02-08 14:06

    Have you tried using all three of these (also try swapping for getSupportActionbar())?

     getActionBar().setDisplayShowHomeEnabled(true);
     getActionBar().setHomeButtonEnabled(true);
     getActionBar().setDisplayHomeAsUpEnabled(true); 
    

    Have you tried handling the button manually?

    @Override
    public boolean onOptionsItemSelected(int featureId, MenuItem item) {
         int itemId = item.getItemId();
         if(itemId == android.R.id.home){
             // Do stuff
         }
         return true;
    }
    

提交回复
热议问题