最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android 動(dòng)畫(huà)之AlphaAnimation應(yīng)用詳解

 更新時(shí)間:2012年12月02日 15:59:42   作者:  
本節(jié)講解AlphaAnimation 動(dòng)畫(huà),窗口的動(dòng)畫(huà)效果,淡入淡出什么的,有些游戲的歡迎動(dòng)畫(huà),logo的淡入淡出效果就使用AlphaAnimation,具體的祥看本文,需要的朋友可以參考下
android中提供了4中動(dòng)畫(huà):
AlphaAnimation 透明度動(dòng)畫(huà)效果
ScaleAnimation 縮放動(dòng)畫(huà)效果
TranslateAnimation 位移動(dòng)畫(huà)效果
RotateAnimation 旋轉(zhuǎn)動(dòng)畫(huà)效果 

本節(jié)講解AlphaAnimation 動(dòng)畫(huà),窗口的動(dòng)畫(huà)效果,淡入淡出什么的,有些游戲的歡迎動(dòng)畫(huà),logo的淡入淡出效果就使用AlphaAnimation。
直接看代碼:
復(fù)制代碼 代碼如下:

public class MainActivity extends Activity {
ImageView image;
Button start;
Button cancel;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image = (ImageView) findViewById(R.id.main_img);
start = (Button) findViewById(R.id.main_start);
cancel = (Button) findViewById(R.id.main_cancel);
/** 設(shè)置透明度漸變動(dòng)畫(huà) */
final AlphaAnimation animation = new AlphaAnimation(1, 0);
animation.setDuration(2000);//設(shè)置動(dòng)畫(huà)持續(xù)時(shí)間
/** 常用方法 */
//animation.setRepeatCount(int repeatCount);//設(shè)置重復(fù)次數(shù)
//animation.setFillAfter(boolean);//動(dòng)畫(huà)執(zhí)行完后是否停留在執(zhí)行完的狀態(tài)
//animation.setStartOffset(long startOffset);//執(zhí)行前的等待時(shí)間
start.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
image.setAnimation(animation);
/** 開(kāi)始動(dòng)畫(huà) */
animation.startNow();
}
});
cancel.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
/** 結(jié)束動(dòng)畫(huà) */
animation.cancel();
}
});
}
}<SPAN style="COLOR: #333333; FONT-FAMILY: Microsoft YaHei"><SPAN style="FONT-SIZE: 14px; LINE-HEIGHT: 26px">
</SPAN></SPAN>

效果:

相關(guān)文章

最新評(píng)論

麻阳| 固原市| 高阳县| 普格县| 河西区| 台北县| 烟台市| 儋州市| 五指山市| 农安县| 肥乡县| 林州市| 无极县| 平阳县| 南开区| 长丰县| 陆河县| 林州市| 普兰店市| 黄浦区| 保德县| 务川| 苍梧县| 高唐县| 高平市| 资阳市| 贵德县| 肃宁县| 乃东县| 九江县| 治多县| 临江市| 瑞金市| 安平县| 中阳县| 镇安县| 无为县| 都兰县| 霍林郭勒市| 永仁县| 临城县|