我在res/anim
文件夾這兩個文件:是否有可能從另一個繼承anim xml資源並覆蓋屬性?
my_anim.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<rotate
android:duration="3000"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="restart"
android:toDegrees="360" />
</set>
my_anim_faster.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<rotate
android:duration="1000"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="restart"
android:toDegrees="360" />
</set>
兩者都是相同的動畫,只有速度(android:duration
) 變化。有沒有辦法縮短這段代碼?例如,由my_anim_faster
繼承自my_anim
並覆蓋android:duration
屬性或類似的東西。
謝謝。
謝謝。我雖然有一種像'style' /'theme'資源中的'parent'屬性的方式。我會通過代碼來完成。 –
歡迎,高興地看到我幫助:) –