小编Cyn*_*ght的帖子

为Shape的笔触宽度设置动画

我有一个带有透明中心的粗圆:

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid
        android:color="@android:color/transparent"/>
    <stroke
        android:width="24dp"
        android:color="@android:color/white"/>
    <size
        android:width="72dp"
        android:height="72dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

并希望动画减少笔画值,使透明中心像虹膜一样扩张.

<set xmlns:android="http://schemas.android.com/apk/res/android">
    <objectAnimator
        android:propertyName="????"
        android:valueFrom="24dp"
        android:valueTo="4dp"
        android:duration="750"
        />
</set>
Run Code Online (Sandbox Code Playgroud)

...但我不知道要指定什么作为属性名称."strokeWidth"似乎不起作用.我甚至不确定如何以编程方式将其拉出来,因为GradientDrawable.setStroke()需要宽度和颜色,而objectAnimator只能操作单个参数属性.

animation geometry android stroke android-5.0-lollipop

4
推荐指数
1
解决办法
5115
查看次数