2 回答

TA貢獻1859條經驗 獲得超6個贊
這是答案,盡管它僅適用于3.0及更高版本。
1)創(chuàng)建一個名為“動畫師”的新資源文件夾。
2)創(chuàng)建一個新的.xml文件,我稱之為“翻轉”。使用以下 XML 代碼:
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:valueFrom="0" android:valueTo="360" android:propertyName="rotationY" >
</objectAnimator>
不可以,對象動畫器標記不以大寫字母“O”開頭。
3) 使用以下代碼開始動畫:
ObjectAnimator anim = (ObjectAnimator) AnimatorInflater.loadAnimator(mContext, R.animator.flipping);
anim.setTarget(A View Object reference goes here i.e. ImageView);
anim.setDuration(3000);
anim.start();

TA貢獻1780條經驗 獲得超5個贊
這是一個偉大的圖書館與一堆動畫。
嘗試YoYo動畫任何類型的視圖。
在應用程序的生成.gradle 文件中添加以下依賴項
dependencies {
compile 'com.android.support:support-compat:25.1.1'
compile 'com.daimajia.easing:library:2.0@aar'
compile 'com.daimajia.androidanimations:library:2.3@aar'
}
例:
YoYo.with(Techniques.FlipOutY)
.duration(700)
.repeat(5) // If you want to do INFINITELY then set "-1" value here
.playOn(findViewById(R.id.edit_area));
添加回答
舉報