我可以将动画列表项的安卓:持续时间移动到 attrs.xml 吗?



有没有可能有这样的动画:

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false" >
    <item
        android:drawable="@drawable/pr_l_b01"
        android:duration="@dont-know-what/animation_frame_duration"/>
    <item
        android:drawable="@drawable/pr_l_b02"
        android:duration="@dont-know-what/animation_frame_duration"/>
    <item
        android:drawable="@drawable/pr_l_b03"
        android:duration="@dont-know-what/animation_frame_duration"/>
</animation-list>

attrs.xml

<dont-know-what name="animation_frame_duration"/></dont-know-what>

看看安卓开发者中的持续时间属性。

这也可能是对资源的引用(格式为"@[package:]type:name")或主题属性(格式为"?[包含此类型值的包:][类型:]名称"。

在值中插入持续时间值.xml如下所示:

<resources>
    <integer name="duration">700</integer>
</resources>

并像这样使用它:

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false" >
    <item
        android:drawable="@drawable/pr_l_b01"
        android:duration="@integer/duration"/>
</animation-list>

最新更新