How to implement the Android ActionBar back button?

后端 未结 12 2202
天涯浪人
天涯浪人 2020-11-29 15:38

I have an activity with a listview. When the user click the item, the item \"viewer\" opens:

List1.setOnItemClickListener(new OnItemClickListener() {
    @Ov         


        
12条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 16:27

    If you are using Toolbar, I was facing the same issue. I solved by following these two steps

    1. In the AndroidManifest.xml
    
    
    1. In the SecondActivity, add these...
    Toolbar toolbar = findViewById(R.id.second_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    

提交回复
热议问题