Add back button to action bar

后端 未结 11 1709
野趣味
野趣味 2020-12-07 16:23

I have been trying to add a back button to the action bar.

I want my view to look like this: \"enter

11条回答
  •  无人及你
    2020-12-07 16:57

    Add this line in onCreate() method

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    

    then Override this method

     @Override
        public boolean onSupportNavigateUp(){
            finish();
            return true;
        }
    

提交回复
热议问题