如何使用StateListAnimator在Android中设置图像按钮背景动画?
我想使用sateListAnimator更改ImageButton中后退图标的颜色: 图像按钮xml:如何使用StateListAnimator在Android中设置图像按钮背景动画?,android,animation,animator,Android,Animation,Animator,我想使用sateListAnimator更改ImageButton中后退图标的颜色: 图像按钮xml: <ImageButton android:id="@+id/back_btn" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/ic_back" android:backgroundTint=
<ImageButton
android:id="@+id/back_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_back"
android:backgroundTint="@color/colorWhite"
android:stateListAnimator="@animator/color_animation_btn" />
颜色\u动画\u btn xml:
<item android:state_pressed="true">
<set>
<objectAnimator
android:duration="100"
android:propertyName="backgroundTint"
android:valueTo="@color/colorBlack"
android:valueType="colorType"
/>
</set>
</item>
但这段代码不起作用:按钮的backgroundTint并没有改变,但如果我在xml中改变backgroundTint,它就会起作用。那么有没有办法改变图标的颜色呢