2

次のようなアニメーションを作成することは可能ですか。

<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>

?

4

1 に答える 1

8

Android 開発者の期間属性を見てください。

これは、この型の値を含むリソース ("@[package:]type:name" の形式) またはテーマ属性 ("?[package:][type:]name" の形式) への参照である場合もあります。 .

次のように、values.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>
于 2013-09-30T15:52:24.250 に答える