新 NavigationView 上的图标动画
Icon animation on the new NavigationView
我正在尝试为我的抽屉切换到新的 NavigationView。
当我这样做时(并且工作正常),当抽屉滑动时,我将菜单图标的动画丢失到后退图标。
我怎样才能在 NavigationView 上看到它?
这是我的代码:
toolbar = (Toolbar) findViewById(R.id.app_bar);
toolbar.setNavigationIcon(R.drawable.ic_menu_white);
setSupportActionBar(toolbar);
mDrawer = (NavigationView) findViewById(R.id.navigation_drawer);
if (mDrawer != null) {
mDrawer.setNavigationItemSelectedListener(this);
}
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
提前致谢!
经过大量研究,我通过简单地添加以下内容解决了这个问题:
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
}
希望对您有所帮助。
我正在尝试为我的抽屉切换到新的 NavigationView。
当我这样做时(并且工作正常),当抽屉滑动时,我将菜单图标的动画丢失到后退图标。
我怎样才能在 NavigationView 上看到它?
这是我的代码:
toolbar = (Toolbar) findViewById(R.id.app_bar);
toolbar.setNavigationIcon(R.drawable.ic_menu_white);
setSupportActionBar(toolbar);
mDrawer = (NavigationView) findViewById(R.id.navigation_drawer);
if (mDrawer != null) {
mDrawer.setNavigationItemSelectedListener(this);
}
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
提前致谢!
经过大量研究,我通过简单地添加以下内容解决了这个问题:
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
}
希望对您有所帮助。