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

Android 動(dòng)畫之ScaleAnimation應(yīng)用詳解

 更新時(shí)間:2012年12月02日 16:24:51   作者:  
本節(jié)講解ScaleAnimation 動(dòng)畫在應(yīng)用中的實(shí)現(xiàn),有需要的朋友可以參考下
android中提供了4中動(dòng)畫:
AlphaAnimation 透明度動(dòng)畫效果
ScaleAnimation 縮放動(dòng)畫效果
TranslateAnimation 位移動(dòng)畫效果
RotateAnimation 旋轉(zhuǎn)動(dòng)畫效果

本節(jié)講解ScaleAnimation 動(dòng)畫,
ScaleAnimation(float fromX, float toX, float fromY, float toY,int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
參數(shù)說明:
復(fù)制代碼 代碼如下:

float fromX 動(dòng)畫起始時(shí) X坐標(biāo)上的伸縮尺寸
float toX 動(dòng)畫結(jié)束時(shí) X坐標(biāo)上的伸縮尺寸
float fromY 動(dòng)畫起始時(shí)Y坐標(biāo)上的伸縮尺寸
float toY 動(dòng)畫結(jié)束時(shí)Y坐標(biāo)上的伸縮尺寸
int pivotXType 動(dòng)畫在X軸相對(duì)于物件位置類型
float pivotXValue 動(dòng)畫相對(duì)于物件的X坐標(biāo)的開始位置
int pivotYType 動(dòng)畫在Y軸相對(duì)于物件位置類型
float pivotYValue 動(dòng)畫相對(duì)于物件的Y坐標(biāo)的開始位置

代碼:
復(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)畫 */
final ScaleAnimation animation =new ScaleAnimation(0.0f, 1.4f, 0.0f, 1.4f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setDuration(2000);//設(shè)置動(dòng)畫持續(xù)時(shí)間
/** 常用方法 */
//animation.setRepeatCount(int repeatCount);//設(shè)置重復(fù)次數(shù)
//animation.setFillAfter(boolean);//動(dòng)畫執(zhí)行完后是否停留在執(zhí)行完的狀態(tài)
//animation.setStartOffset(long startOffset);//執(zhí)行前的等待時(shí)間
start.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
image.setAnimation(animation);
/** 開始動(dòng)畫 */
animation.startNow();
}
});
cancel.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
/** 結(jié)束動(dòng)畫 */
animation.cancel();
}
});
}
}

效果:

相關(guān)文章

最新評(píng)論

全州县| 崇礼县| 灵璧县| 客服| 潞城市| 社旗县| 富源县| 盐津县| 桐柏县| 古丈县| 铁岭县| 即墨市| 金乡县| 信丰县| 临沂市| 宁德市| 咸阳市| 上饶市| 高淳县| 北川| 凭祥市| 抚松县| 留坝县| 青岛市| 芜湖市| 绿春县| 绥中县| 明光市| 嘉峪关市| 兴化市| 保康县| 牡丹江市| 肇州县| 本溪| 科技| 新密市| 磐安县| 尖扎县| 龙江县| 长岭县| 托里县|