Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in onPostCreate work?

别来无恙 提交于 2019-12-06 10:24:21

Here onPostCreate:

@Override
public void onPostCreate(Bundle savedInstanceState,
        PersistableBundle persistentState) {
    super.onPostCreate(savedInstanceState, persistentState);
    drawerToggle.syncState();
}

It should be this:

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    drawerToggle.syncState();
}

There are two types of onPostCreate:

  1. Activity's onPostCreate with two arguments.
  2. AppCompatActivity's onPostCreate with a single argument.

You should have made a mistake to choose the former one when you override a method on Android Studio.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!