Android動(dòng)畫(huà)系列之幀動(dòng)畫(huà)和補(bǔ)間動(dòng)畫(huà)的示例代碼
Android 提供三種動(dòng)畫(huà):幀動(dòng)畫(huà)、補(bǔ)間動(dòng)畫(huà)和屬性動(dòng)畫(huà),本篇文章介紹幀動(dòng)畫(huà)以及補(bǔ)間動(dòng)畫(huà)的使用,屬性動(dòng)畫(huà)的使用將在后面的文章中分享,那就來(lái)復(fù)習(xí)一下這兩種動(dòng)畫(huà)的使用吧。
FrameAnimation
FrameAnimation 即逐幀動(dòng)畫(huà),通俗來(lái)說(shuō)就是按照?qǐng)D片動(dòng)作順序依次播放來(lái)形成動(dòng)畫(huà),創(chuàng)建 FrameAnimation 可用 xml 定義也可直接使用代碼創(chuàng)建。
xml創(chuàng)建幀動(dòng)畫(huà)
在 res/drawable 文件夾下創(chuàng)建一個(gè) drawable 文件,使用 animation-list 標(biāo)簽,具體內(nèi)容如下:
<?xml version="1.0" encoding="utf-8"?> <!--FrameAnimator--> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:drawable="@drawable/zzlx1" android:duration="100" /> <item android:drawable="@drawable/zzlx2" android:duration="100" /> <item android:drawable="@drawable/zzlx3" android:duration="100" /> <!--...--> </animation-list>
屬性 oneshot 為 true 表示動(dòng)畫(huà)只能播放一次,false 表示動(dòng)畫(huà)循環(huán)播放,drawable 是當(dāng)前動(dòng)作對(duì)應(yīng)的圖片,duration 是其持續(xù)時(shí)間,duration 長(zhǎng)度影響動(dòng)畫(huà)播放的快慢,然后在 Activity 中使用獲取該 drawable 文件對(duì)應(yīng)的 AnimationDrawable,然后使用 AnimationDrawable 對(duì)象來(lái)控制動(dòng)畫(huà)的狀態(tài),參考如下:
//獲取Frame動(dòng)畫(huà)文件對(duì)應(yīng)的AnimationDrawable mAnimationDrawable = (AnimationDrawable) getResources().getDrawable(R.drawable.frame_animator); //設(shè)置AnimationDrawable為圖片的背景 imageView.setBackground(mAnimationDrawable); //開(kāi)啟動(dòng)畫(huà) mAnimationDrawable.start(); //停止動(dòng)畫(huà) mAnimationDrawable.stop();
代碼創(chuàng)建幀動(dòng)畫(huà)
使用代碼創(chuàng)建幀動(dòng)畫(huà)就是創(chuàng)建 AnimationDrawable 對(duì)象,然后在 AnimationDrawable 中添加對(duì)應(yīng)的 Frame 即可,代碼參考如下:
//代碼創(chuàng)建Frame動(dòng)畫(huà) mAnimationDrawable = new AnimationDrawable(); //設(shè)置動(dòng)畫(huà)循環(huán)播放,true為動(dòng)畫(huà)只播放一次 mAnimationDrawable.setOneShot(false); mAnimationDrawable.addFrame(getResources().getDrawable(R.drawable.zzlx1),100); mAnimationDrawable.addFrame(getResources().getDrawable(R.drawable.zzlx2),100); mAnimationDrawable.addFrame(getResources().getDrawable(R.drawable.zzlx3),100); //... imageView.setBackground(mAnimationDrawable); //開(kāi)啟動(dòng)畫(huà) mAnimationDrawable.start(); //停止動(dòng)畫(huà) mAnimationDrawable.stop();
FrameAnimation 效果如下:
TweenAnimation
TweenAnimation 即常說(shuō)的補(bǔ)間動(dòng)畫(huà),主要有以下幾種:
- 位移動(dòng)畫(huà)(Translation)
- 縮放動(dòng)畫(huà)(Scale)
- 旋轉(zhuǎn)動(dòng)畫(huà)(Rotate)
- 透明度動(dòng)畫(huà)(Alpha)
- 組合動(dòng)畫(huà)
上述動(dòng)畫(huà)都有自己特有的一下屬性,下面來(lái)看一看這些動(dòng)畫(huà)通用的一些屬性,具體如下:
<!--設(shè)置動(dòng)畫(huà)持續(xù)時(shí)間--> android:duration="1200" <!--動(dòng)畫(huà)開(kāi)始的延時(shí)--> android:startOffset ="1000" <!--動(dòng)畫(huà)播放完是否回到動(dòng)畫(huà)開(kāi)始的位置,默認(rèn)true,如果fillBefore設(shè)置為false,動(dòng)畫(huà)不會(huì)停留在結(jié)束位置,不知道是不是bug--> android:fillBefore = "true" <!--動(dòng)畫(huà)播放完之后是否回到動(dòng)畫(huà)結(jié)束的位置,默認(rèn)false,如果fillAfter設(shè)置為true,動(dòng)畫(huà)則會(huì)停留在結(jié)束位置--> android:fillAfter = "false" <!--設(shè)置fill...屬性是否啟用,對(duì)fillAfter無(wú)效--> android:fillEnabled= "true" <!--設(shè)置動(dòng)畫(huà)重復(fù)模式,restart為重新播放,reverse為倒序回放,和repeatCount搭配使用--> android:repeatMode = "restart" <!--設(shè)置動(dòng)畫(huà)重復(fù)次數(shù)--> android:repeatCount = "0" <!--設(shè)置動(dòng)畫(huà)插值器,這里的插值器是動(dòng)畫(huà)開(kāi)始速度較慢,后面加速--> android:interpolator = "@android:anim/accelerate_interpolator"
如果在代碼中進(jìn)行對(duì)應(yīng)動(dòng)畫(huà)實(shí)現(xiàn),這些屬性也有對(duì)應(yīng)的屬性設(shè)置,直接設(shè)置即可。
位移動(dòng)畫(huà)(Translate)
位移動(dòng)畫(huà)對(duì) View 進(jìn)行水平方向或垂直方向位置的平移,可指定起始位置和結(jié)束位置,可使用 xml 定義位移動(dòng)畫(huà)也可以使用代碼創(chuàng)建位移動(dòng)畫(huà),位移動(dòng)畫(huà)對(duì)應(yīng)的 Animation 的子類是 TranslateAnimation。
xml定義位移動(dòng)畫(huà):在 res/anim 下創(chuàng)建一個(gè)xml文件 translation_anim.xml,在該文件中定義位移動(dòng)畫(huà)如下:
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1200" android:startOffset ="0" android:fillBefore = "true" android:fillAfter = "false" android:fillEnabled= "false" android:repeatMode = "reverse" android:repeatCount = "5" android:interpolator = "@android:anim/accelerate_interpolator" android:fromXDelta="0" android:fromYDelta="0" android:toXDelta="100" android:toYDelta="100">
上述 xml 文件定義了一個(gè)位移動(dòng)畫(huà)文件,其中位移動(dòng)畫(huà)自有的屬性含義如下:
<!--水平方向動(dòng)畫(huà)開(kāi)始的位置--> android:fromXDelta="0" <!--垂直方向動(dòng)畫(huà)開(kāi)始的位置--> android:fromYDelta="0" <!--水平方向動(dòng)畫(huà)結(jié)束的位置--> android:toXDelta="100" <!--垂直方向動(dòng)畫(huà)結(jié)束的位置--> android:toYDelta="100"
然后在 Activity 中獲取該 xml 文件對(duì)應(yīng)的 TranslateAnimation,將其設(shè)置到想要設(shè)置位移動(dòng)畫(huà)的 View 上即可,具體如下:
private void translation(){ //獲取在anim下定義的動(dòng)畫(huà)文件 TranslateAnimation translateAnimation = (TranslateAnimation) AnimationUtils.loadAnimation(this, R.anim.translation_anim);、 //設(shè)置并開(kāi)啟動(dòng)畫(huà) ivImage.startAnimation(translateAnimation); }
代碼中創(chuàng)建位移動(dòng)畫(huà):代碼創(chuàng)建位移動(dòng)畫(huà)使用 Animation 的子類 TranslateAnimation,使用時(shí)直接創(chuàng)建 TranslateAnimation 對(duì)象即可,具體如下:
//代碼創(chuàng)建位移動(dòng)畫(huà) private void translation(){ //表示相對(duì)View自身原點(diǎn)(View左上角)像素偏移量 TranslateAnimation translateAnimation = new TranslateAnimation(0,100,0,100); //設(shè)置動(dòng)畫(huà)持續(xù)時(shí)間 translateAnimation.setDuration(1200); //設(shè)置動(dòng)畫(huà)重復(fù)模式 translateAnimation.setRepeatMode(Animation.REVERSE); //設(shè)置動(dòng)畫(huà)重復(fù)次數(shù) translateAnimation.setRepeatCount(3); translateAnimation.setFillAfter(true); //設(shè)置動(dòng)畫(huà)插值器 translateAnimation.setInterpolator(this,android.R.anim.accelerate_interpolator); // translateAnimation.setInterpolator(new AccelerateInterpolator()); //... ivImage.startAnimation(translateAnimation); }
上面參數(shù)中使用的時(shí)像素的偏移量,API 還提供了針對(duì) View 自身一個(gè)父 View 的百分比的設(shè)置方式,下面這種創(chuàng)建 TranslateAnimation 對(duì)象的方式和上面實(shí)現(xiàn)的效果是一樣的。具體如下:
/** * ABSOLUTE:表示相對(duì)View自身原點(diǎn)(View左上角)像素偏移量 * 此時(shí)和TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)一樣 * RELATIVE_TO_SELF:表示相對(duì)View自身的百分比,如0.5f表示View自身大小的50%,1.0f表示View自身大小 * RELATIVE_TO_PARENT:表示相對(duì)父View的百分比,如0.5f表示View自身大小的50%,1.0f表示View自身大小 */ TranslateAnimation translateAnimation = new TranslateAnimation( Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0.46f, Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0.46f);
使用時(shí)可根據(jù)需要選擇合適的構(gòu)造方式創(chuàng)建 TranslateAnimation,測(cè)試效果如下:
縮放動(dòng)畫(huà)(Scale)
縮放動(dòng)畫(huà)對(duì) View 就是對(duì)視圖進(jìn)行一定程度的放大和縮小,可使用 xml 定義位移動(dòng)畫(huà)也可以使用代碼創(chuàng)建位移動(dòng)畫(huà),縮放動(dòng)畫(huà)對(duì)應(yīng)的 Animation 的子類是 ScaleAnimation。
xml定義縮放動(dòng)畫(huà):在 res/anim 下創(chuàng)建一個(gè) xml 文件 scale_anim.xml,在里面定義縮放動(dòng)畫(huà),具體如下:
<?xml version="1.0" encoding="utf-8"?> <scale xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1200" android:startOffset ="0" android:fillBefore = "true" android:fillAfter = "false" android:fillEnabled= "false" android:repeatMode = "reverse" android:repeatCount = "3" android:interpolator = "@android:anim/accelerate_interpolator" android:fromXScale="1" android:fromYScale="1" android:toXScale="3" android:toYScale="3" android:pivotX="50%" android:pivotY="50%"> </scale>
上述 xml 文件定義了一個(gè)縮放動(dòng)畫(huà)文件,其中縮放動(dòng)畫(huà)自有的屬性含義如下:
<!--設(shè)置水平方向上的起始縮放倍數(shù)--> android:fromXScale="1" <!--設(shè)置垂直方向上的起始縮放倍數(shù)--> android:fromYScale="1" <!--設(shè)置水平方向上的結(jié)束縮放倍數(shù)--> android:toXScale="3" <!--設(shè)置垂直方向上的結(jié)束縮放倍數(shù)--> android:toYScale="3" <!--設(shè)置縮放中心水平方向上的坐標(biāo)--> android:pivotX="50%" <!--設(shè)置縮放中心垂直方向上的坐標(biāo)--> android:pivotY="50%">
其中 pivotX 和 pivotY 有三種設(shè)置方式:
- 數(shù)字:如50表示縮放中心相較 View 原點(diǎn)偏移 50px
- 百分比:如 50% 表示縮放中心相較 View 原點(diǎn)偏移 View 自身大小的 50%
- 百分比p:如 50%p 表示縮放中心相較 View 原點(diǎn)偏移父 View 自身大小的 50%
然后在 Activity 中獲取該 xml 文件對(duì)應(yīng)的 ScaleAnimation,將其設(shè)置到想要設(shè)置位移動(dòng)畫(huà)的 View 上即可,具體如下:
private void scale(){ ScaleAnimation scaleAnimation = (ScaleAnimation) AnimationUtils.loadAnimation(this,R.anim.scale_anim); ivImage.startAnimation(scaleAnimation); }
代碼創(chuàng)建縮放動(dòng)畫(huà):代碼創(chuàng)建縮放動(dòng)畫(huà)使用 Animation 的子類 ScaleAnimation,使用時(shí)直接創(chuàng)建 ScaleAnimation 對(duì)象即可,具體如下:
//代碼創(chuàng)建縮放動(dòng)畫(huà) private void scale(){ ScaleAnimation scaleAnimation = new ScaleAnimation(1,3,1,3, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setDuration(500); scaleAnimation.setRepeatCount(5); scaleAnimation.setInterpolator(this,android.R.anim.accelerate_decelerate_interpolator); // translateAnimation.setInterpolator(new AccelerateInterpolator()); //... ivImage.startAnimation(scaleAnimation); }
至于參數(shù)中的 pivotXType 和 pivotYType 和在上文中已經(jīng)提到過(guò),這里就不在贅述,測(cè)試效果如下:
旋轉(zhuǎn)動(dòng)畫(huà)(Rotate)
旋轉(zhuǎn)動(dòng)畫(huà)對(duì) View 就是對(duì)視圖角度進(jìn)行旋轉(zhuǎn),可使用 xml 定義旋轉(zhuǎn)動(dòng)畫(huà)也可以使用代碼創(chuàng)建旋轉(zhuǎn)動(dòng)畫(huà),旋轉(zhuǎn)動(dòng)畫(huà)對(duì)應(yīng)的 Animation 的子類是 RotateAnimation。
xml定義旋轉(zhuǎn)動(dòng)畫(huà):在 res/anim 下創(chuàng)建一個(gè) xml 文件 rotate_anim.xml,在里面定義縮放動(dòng)畫(huà),具體如下:
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1200" android:startOffset ="0" android:fillBefore = "true" android:fillAfter = "false" android:fillEnabled= "false" android:repeatMode = "reverse" android:repeatCount = "5" android:interpolator = "@android:anim/accelerate_interpolator" android:fromDegrees="0" android:toDegrees="100" android:pivotY="50%" android:pivotX="50%"> </rotate>
上述 xml 文件定義了一個(gè)旋轉(zhuǎn)動(dòng)畫(huà)文件,其中縮放動(dòng)畫(huà)自有的屬性含義如下:
<!--設(shè)置動(dòng)畫(huà)開(kāi)始時(shí)的角度,正數(shù)表示順時(shí)針,負(fù)數(shù)表示逆時(shí)針--> android:fromDegrees="0" <!--設(shè)置動(dòng)畫(huà)結(jié)束時(shí)的角度,正數(shù)表示順時(shí)針,負(fù)數(shù)表示逆時(shí)針--> android:toDegrees="100" <!--設(shè)置水平方向旋轉(zhuǎn)中心點(diǎn)的坐標(biāo)--> android:pivotY="50%" <!--設(shè)置垂直方向旋轉(zhuǎn)中心點(diǎn)的坐標(biāo)--> android:pivotX="50%"
其中 pivotX 和 pivotY 有三種設(shè)置方式在上文中已經(jīng)說(shuō)明。然后在 Activity 中獲取該 xml 文件對(duì)應(yīng)的 RotateAnimation,將其設(shè)置到想要設(shè)置旋轉(zhuǎn)動(dòng)畫(huà)的 View 上即可,具體如下:
private void rotate(){ RotateAnimation rotateAnimation = (RotateAnimation) AnimationUtils.loadAnimation(this,R.anim.rotate_anim); ivImage.startAnimation(rotateAnimation); }
代碼創(chuàng)建旋轉(zhuǎn)動(dòng)畫(huà):代碼創(chuàng)建旋轉(zhuǎn)動(dòng)畫(huà)使用 Animation 的子類 RotateAnimation,使用時(shí)直接創(chuàng)建 RotateAnimation 對(duì)象即可,具體如下:
//代碼創(chuàng)建旋轉(zhuǎn)動(dòng)畫(huà) private void rotate(){ RotateAnimation rotateAnimation = new RotateAnimation(0,100, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f); rotateAnimation.setRepeatMode(Animation.REVERSE); rotateAnimation.setDuration(1200); rotateAnimation.setRepeatCount(3); rotateAnimation.setInterpolator(this,android.R.anim.accelerate_decelerate_interpolator); // translateAnimation.setInterpolator(new AccelerateInterpolator()); //... ivImage.startAnimation(rotateAnimation); }
測(cè)試效果如下:
透明度動(dòng)畫(huà)(Alpha)
透明度動(dòng)畫(huà)就是修改 View 的透明度,可使用 xml 定義透明度動(dòng)畫(huà)也可以使用代碼創(chuàng)建透明度動(dòng)畫(huà),透明度動(dòng)畫(huà)對(duì)應(yīng)的 Animation 的子類是 AlphaAnimation。
xml定義透明度動(dòng)畫(huà):在 res/anim 下創(chuàng)建一個(gè) xml 文件 alpha_anim.xml,在里面定義縮放動(dòng)畫(huà),具體如下:
<?xml version="1.0" encoding="utf-8"?> <alpha xmlns:android="http://schemas.android.com/apk/res/android" android:duration="3000" android:startOffset ="0" android:fillBefore = "true" android:fillAfter = "true" android:fillEnabled= "false" android:repeatMode = "restart" android:repeatCount = "0" android:interpolator = "@android:anim/accelerate_interpolator" android:fromAlpha="1" android:toAlpha="0"> </alpha>
上述 xml 文件定義了一個(gè)透明度動(dòng)畫(huà)文件,其中透明度動(dòng)畫(huà)自有的屬性含義如下:
<!--設(shè)置動(dòng)畫(huà)的開(kāi)始透明度,0表示透明,1表示不透明--> android:fromAlpha="1" <!--設(shè)置動(dòng)畫(huà)的結(jié)束透明度,0表示透明,1表示不透明--> android:toAlpha="0"
然后在 Activity 中獲取該 xml 文件對(duì)應(yīng)的 AlphaAnimation,將其設(shè)置到想要設(shè)置旋轉(zhuǎn)動(dòng)畫(huà)的 View 上即可,具體如下:
private void alpha(){ AlphaAnimation alphaAnimation = (AlphaAnimation) AnimationUtils.loadAnimation(this,R.anim.alpha_anim); ivImage.startAnimation(alphaAnimation); }
代碼創(chuàng)建透明度動(dòng)畫(huà):代碼創(chuàng)建透明度動(dòng)畫(huà)使用 Animation 的子類 AlphaAnimation,使用時(shí)直接創(chuàng)建 AlphaAnimation 對(duì)象即可,具體如下:
//代碼創(chuàng)建透明度動(dòng)畫(huà) private void alpha(){ AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f,0.0f); alphaAnimation.setRepeatMode(Animation.RESTART); alphaAnimation.setDuration(1500); alphaAnimation.setRepeatCount(3); // alphaAnimation.setInterpolator(this,android.R.anim.accelerate_decelerate_interpolator); // translateAnimation.setInterpolator(new AccelerateInterpolator()); //... ivImage.startAnimation(alphaAnimation); }
透明度動(dòng)畫(huà)測(cè)試效果如下:
到此為止,位移、縮放、旋轉(zhuǎn)、透明度動(dòng)畫(huà)的內(nèi)容介紹完了,除了單獨(dú)使用這些動(dòng)畫(huà),還可以組合這些動(dòng)畫(huà)實(shí)現(xiàn)更復(fù)雜的動(dòng)畫(huà),
組合動(dòng)畫(huà)
組合動(dòng)畫(huà)使用 AnimationSet 來(lái)實(shí)現(xiàn),可使用 xml 定義組合動(dòng)畫(huà)也可以使用代碼創(chuàng)建組合動(dòng)畫(huà),透明度動(dòng)畫(huà)對(duì)應(yīng)的 Animation 的子類是 AnimationSet。
xml定義組合動(dòng)畫(huà):在 res/anim 下創(chuàng)建一個(gè) xml 文件 combine_anim.xml,在里面定義組合動(dòng)畫(huà),具體如下:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1200"> <!--透明度動(dòng)畫(huà)--> <alpha android:repeatMode="reverse" android:repeatCount="10" android:fromAlpha="1" android:toAlpha="0.5" /> <!--旋轉(zhuǎn)動(dòng)畫(huà)--> <rotate android:repeatMode="reverse" android:repeatCount="10" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:toDegrees="360" /> <!--縮放動(dòng)畫(huà)--> <scale android:repeatMode="reverse" android:repeatCount="10" android:fromXScale="1" android:fromYScale="1" android:pivotX="50%" android:pivotY="50%" android:toXScale="3" android:toYScale="3" /> </set>
然后在 Activity 中獲取該 xml 文件對(duì)應(yīng)的 AnimationSet,將其設(shè)置到想要設(shè)置旋轉(zhuǎn)動(dòng)畫(huà)的 View 上即可,具體如下:
private void combine(){ AnimationSet animationSet = (AnimationSet) AnimationUtils.loadAnimation(this,R.anim.combine_anim); ivImage.startAnimation(animationSet); }
代碼創(chuàng)建組合動(dòng)畫(huà):代碼創(chuàng)建組合動(dòng)畫(huà)使用 Animation 的子類 AnimationSet,使用時(shí)直接創(chuàng)建 AnimationSet 對(duì)象,將要組合的動(dòng)畫(huà)按序添加到 AnimationSet 中,具體如下:
//代碼創(chuàng)建組合動(dòng)畫(huà) private void combine(){ AnimationSet animationSet = new AnimationSet(true); AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f,0.3f); alphaAnimation.setRepeatMode(Animation.REVERSE); alphaAnimation.setRepeatCount(3); RotateAnimation rotateAnimation = new RotateAnimation(0,360, Animation.RELATIVE_TO_SELF,0.5f, Animation.RELATIVE_TO_SELF,0.5f); rotateAnimation.setRepeatMode(Animation.REVERSE); rotateAnimation.setRepeatCount(3); ScaleAnimation scaleAnimation = new ScaleAnimation(1,3,1,3, Animation.RELATIVE_TO_SELF,0.5f, Animation.RELATIVE_TO_SELF,0.5f); scaleAnimation.setRepeatMode(Animation.REVERSE); scaleAnimation.setRepeatCount(3); animationSet.addAnimation(alphaAnimation); animationSet.addAnimation(rotateAnimation); animationSet.addAnimation(scaleAnimation); animationSet.setDuration(1200); //AnimationSet不支持動(dòng)畫(huà)重復(fù)播放,如果想要組合動(dòng)畫(huà)重復(fù)播放可設(shè)置每個(gè)動(dòng)畫(huà)重復(fù)播放即可 // animationSet.setRepeatMode(Animation.REVERSE); // animationSet.setRepeatCount(10); ivImage.startAnimation(animationSet); }
組合動(dòng)畫(huà)測(cè)試效果如下:
總結(jié)
這篇文章總結(jié)了 Android 開(kāi)發(fā)中幀動(dòng)畫(huà)(FrameAnimation)和補(bǔ)間動(dòng)畫(huà)(TweenAnimation)的使用,下一篇將會(huì)介紹屬性動(dòng)畫(huà)(ObjectAnimator )。
到此這篇關(guān)于Android動(dòng)畫(huà)系列之幀動(dòng)畫(huà)和補(bǔ)間動(dòng)畫(huà)的示例代碼的文章就介紹到這了,更多相關(guān)Android幀動(dòng)畫(huà)和補(bǔ)間動(dòng)畫(huà)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Android編程實(shí)現(xiàn)播放MP3功能示例
這篇文章主要介紹了Android編程實(shí)現(xiàn)播放MP3功能,結(jié)合實(shí)例形式分析了Android播放MP3功能的界面布局與功能實(shí)現(xiàn)相關(guān)操作技巧,需要的朋友可以參考下2017-02-02Android 判斷某個(gè)Activity 是否在前臺(tái)運(yùn)行的實(shí)例
下面小編就為大家分享一篇Android 判斷某個(gè)Activity 是否在前臺(tái)運(yùn)行的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-03-03Android使用gradle讀取并保存數(shù)據(jù)到BuildConfg流程詳解
這篇文章主要介紹了Android使用gradle從資源目錄讀取數(shù)據(jù)并存到BuildConfg內(nèi),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧2023-02-02Android自定義Dialog實(shí)現(xiàn)通用圓角對(duì)話框
這篇文章主要為大家詳細(xì)介紹了Android自定義Dialog實(shí)現(xiàn)通用圓角對(duì)話框,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-11-11Android自定義TitleView標(biāo)題開(kāi)發(fā)實(shí)例
這篇文章主要介紹了Android自定義TitleView標(biāo)題開(kāi)發(fā)實(shí)例的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-09-09Android仿QQ復(fù)制昵稱效果的實(shí)現(xiàn)方法
這篇文章主要介紹了Android仿QQ復(fù)制昵稱效果的實(shí)現(xiàn)方法,主要依賴的是一個(gè)開(kāi)源項(xiàng)目,需要的朋友可以參考下2019-05-05Android自定義View實(shí)現(xiàn)餅狀圖帶動(dòng)畫(huà)效果
這篇文章主要為大家詳細(xì)介紹了Android自定義View實(shí)現(xiàn)餅狀圖帶動(dòng)畫(huà)效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-12-12Android 使用FragmentTabHost實(shí)現(xiàn)底部菜單功能
這篇文章主要介紹了Android 使用FragmentTabHost實(shí)現(xiàn)底部菜單功能,詳細(xì)給大家介紹了FragmentTabHost配合Fragment的使用方法,需要的朋友可以參考下2017-12-12Android中webView加載H5綁定cookie實(shí)例
這篇文章主要介紹了Android中webView加載H5綁定cookie實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-03-03