getActionBar().setDisplayHomeAsUpEnabled(true) throws NullPointerException

前端 未结 4 1273
一整个雨季
一整个雨季 2021-01-03 00:36

This question is asked several times in stackoverflow and I have tried all of them. But unfortunately neither is working for me.

I am trying to implement the naviga

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-03 00:51

    import v7:

     import android.support.v7.app.ActionBar;
    

    then in the onCreate method:

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    

提交回复
热议问题