I'm trying to achieve that an icon in ActionBar will not change states discretely, but by fading animation. When I add android:enterFadeDuration
and android:exitFadeDuration
to the selector tag, my drawable is initially invisible - when I tap it, it changes state to state_pressed
(properly with enter fade duration) and when I release it, it turns back to its normal visible unselected state.
I must be missing something obvious, or is this a bug of some kind?
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="150" android:exitFadeDuration="150">
<item android:drawable="@drawable/filters_toggle_icon_selected" android:state_focused="true"/>
<item android:drawable="@drawable/filters_toggle_icon_selected" android:state_pressed="true"/>
<item android:drawable="@drawable/filters_toggle_icon" android:state_focused="false" android:state_pressed="false"/>
</selector>