亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android仿打開微信紅包動畫效果實(shí)現(xiàn)代碼

 更新時(shí)間:2017年12月11日 10:49:03   作者:瓦雷  
這篇文章主要介紹了Android仿打開微信紅包動畫效果實(shí)現(xiàn)代碼,非常不錯,具有參考借鑒價(jià)值,需要的朋友可以參考下

首先看下效果:

實(shí)現(xiàn)原理:

準(zhǔn)備3張不同角度的圖片,通過AnimationDrawable幀動畫進(jìn)行播放即可

代碼實(shí)現(xiàn):

1、編寫動畫xml文件:

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> 
 <item android:drawable="@mipmap/open" android:duration="400"></item> 
 <item android:drawable="@mipmap/open3" android:duration="400"></item> 
 <item android:drawable="@mipmap/open2" android:duration="400"></item>
</animation-list>

根標(biāo)簽為animation-list,其中oneshot代表著是否只展示一遍,設(shè)置為false會不停的循環(huán)播放動畫  根標(biāo)簽下,通過item標(biāo)簽對動畫中的每一個(gè)圖片進(jìn)行聲明 
android:duration 表示展示所用的該圖片的時(shí)間長度 ,可通過該參數(shù)來設(shè)置圖片旋轉(zhuǎn)的速度

2、設(shè)置布局控件

<ImageView 
 android:padding="@dimen/dimen_5" 
 android:id="@+id/iv_open" 
 android:layout_centerInParent="true" 
 android:layout_width="@dimen/dimen_100" 
 android:layout_height="@dimen/dimen_100" 
android:background="@drawable/open_red_animation_drawable" />

注意是使用background來加載動畫而不是src

3、代碼中啟動需要播放動畫的控件

//ivOpen指的是需要播放動畫的ImageView控件
AnimationDrawable animationDrawable = (AnimationDrawable)ivOpen.getBackground();
animationDrawable.start();//啟動動畫

總結(jié)

以上所述是小編給大家介紹的Android仿打開微信紅包動畫效果實(shí)現(xiàn)代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論