Clicking app icon doesn't trigger onOptionsItemSelected()

前端 未结 3 1552
别那么骄傲
别那么骄傲 2021-02-04 00:10

I\'m currently working on an Android app. I would like to use the app icon in the action bar to navigate to the \"home\" activity. I read on this page that all that needs to be

3条回答
  •  醉话见心
    2021-02-04 00:43

    If you use Android new support-actionbar (AppCompat) you need to make both calls.

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        getActionBar().setHomeButtonEnabled(true);
    }
    getSupportActionBar().setHomeButtonEnabled(true);
    

提交回复
热议问题