Android Material矢量动画问题

如下的一段代码,是想实现on->off和off->on状态的变化过程,但实际情况是个transition都会走一遍,状态是off->on的transition没走,好像只走了on->off,如果颠倒过来,又只走了on->off。我是希望在on->off状态走一个transition,在off->on状态走另一个transition

<animated-selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/menubtn_on"
        android:drawable="@drawable/ic_menu_moreoverflow_activated"
        android:state_selected="true"/>
    <item
        android:id="@+id/menubtn_off"
        android:drawable="@drawable/ic_menu_moreoverflow"/>
    <transition
        android:fromId="@id/menubtn_off"
        android:toId="@id/menubtn_on" >
        <animated-vector
            android:drawable="@drawable/ic_menu_moreoverflow" >
            <target
                android:name="second_p"
                android:animation="@animator/ic_menu_animation_2" />
            <target
                android:name="third_p"
                android:animation="@animator/ic_menu_animation_3" />
        </animated-vector>
    </transition>
    <transition
        android:fromId="@id/menubtn_on"
        android:toId="@id/menubtn_off" >
        <animated-vector android:drawable="@drawable/ic_menu_moreoverflow_activated" >
            <target
                android:name="second_p"
                android:animation="@animator/ic_menu_animation_b2" />
            <target
                android:name="third_p"
                android:animation="@animator/ic_menu_animation_b3" />
        </animated-vector>
    </transition>
</animated-selector>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值