I have a view based layout (no fragments, one activity) and animate between different states. For better smoothness I use two toolbars and crossfade them.
The problem is, that if I press the navigation button of one toolbar and start the crossfade animation, the navigation button does not restore it's unpressed state (probably due to the animation), resulting in the selector not vanishing... When I now reshow this toolbar, the navigation button looks pressed (the ripple drawable is still visible).
Can I manually clear the ripple animation?
What I tried
I get the toolbar navigation view like following: Get Toolbar's navigation icon view referrence
- I tried clearing the animation of the view:
toolbarNavigationView.clearAnimation()
- I tried resetting the drawable with
ViewCompat.jumpDrawablesToCurrentState(toolbarNavigationView);
I tried posting this to the toolbar to make sure the layout is layed out like following:
toolbar.post(new Runnable() { @Override public void run() { ViewCompat.jumpDrawablesToCurrentState(toolbarNavigationView); } });