麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 系統(tǒng) > Android > 正文

Android 四種動畫效果的調(diào)用實現(xiàn)代碼

2020-04-11 12:33:09
字體:
供稿:網(wǎng)友
(1) main.xml 代碼如下:(聲明四個按鈕控件)

XML代碼:
復制代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:id="@+id/widget32"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TextView
android:id="@+id/widget29"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:layout_x="0px"
android:layout_y="0px"
>
</TextView>
<Button
android:id="@+id/button_Alpha"
android:layout_width="150px"
android:layout_height="150px"
android:text="Alpha動畫"
android:textSize="50px"
android:layout_x="0px"
android:layout_y="30px">
</Button>
<Button
android:id="@+id/button_Scale"
android:layout_width="150px"
android:layout_height="150px"
android:text="Scale動畫"
android:textSize="50px"
android:layout_x="0px"
android:layout_y="180px">
</Button>
<Button
android:layout_width="150px"
android:layout_height="150px"
android:text="Translate動畫"
android:layout_x="161px"
android:layout_y="30px"
android:textSize="30px"
android:id="@+id/button_Translate">
</Button>
<Button
android:id="@+id/button_Rotate"
android:layout_width="150px"
android:layout_height="150px"
android:text="Rotate動畫"
android:layout_y="180px"
android:layout_x="161px"
android:textSize="44px">
</Button>
</AbsoluteLayout>

java代碼:
復制代碼 代碼如下:

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;

public class myActionAnimation extends Activity implements OnClickListener {
/** Called when the activity is first created. */
private Button button_alpha;
private Button button_scale;
private Button button_translate;
private Button button_rotate;
private Animation myAnimation_Alpha;
private Animation myAnimation_Scale;
private Animation myAnimation_Translate;
private Animation myAnimation_Rotate;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

button_alpha = (Button) findViewById(R.id.button_Alpha);
button_alpha.setOnClickListener(this);

button_scale = (Button) findViewById(R.id.button_Scale);
button_scale.setOnClickListener(this);

button_translate = (Button) findViewById(R.id.button_Translate);
button_translate.setOnClickListener(this);

button_rotate = (Button) findViewById(R.id.button_Rotate);
button_rotate.setOnClickListener(this);
}
public void onClick(View button) {
// TODO Auto-generated method stub
switch (button.getId()) {
case R.id.button_Alpha: {
myAnimation_Alpha = AnimationUtils.loadAnimation(this,R.layout.my_alpha_action);
button_alpha.startAnimation(myAnimation_Alpha);
}
break;
case R.id.button_Scale: {
myAnimation_Scale= AnimationUtils.loadAnimation(this,R.layout.my_scale_action);
button_scale.startAnimation(myAnimation_Scale);
}
break;
case R.id.button_Translate: {
myAnimation_Translate= AnimationUtils.loadAnimation(this,R.layout.my_translate_action);
button_translate.startAnimation(myAnimation_Translate);
}
break;
case R.id.button_Rotate: {
myAnimation_Rotate= AnimationUtils.loadAnimation(this,R.layout.my_rotate_action);
button_rotate.startAnimation(myAnimation_Rotate);
}
break;

default:
break;
}
}
}

效果圖:
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 国产1区2区3区中文字幕 | 激情大乳女做爰办公室韩国 | 黄视频在线网站 | 欧美性受xxx黑人xyx性爽 | 日本大片在线播放 | 一区二区视频在线看 | 理论片中文字幕 | 久久欧美亚洲另类专区91大神 | 嫩呦国产一区二区三区av | 视频二区国产 | 97视频| 国产精品刺激对白麻豆99 | 国产剧情v888av | 黑人一区二区三区四区五区 | 精品国产一区三区| 一区二区久久精品66国产精品 | 久在线草 | av成人在线免费观看 | 国产精品久久久久久影视 | 日本网站在线看 | 成人做爽爽爽爽免费国产软件 | 97精品国产高清在线看入口 | 羞羞的视频在线观看 | 亚洲综合色视频在线观看 | 99视频网址| 国产精品99久久久久久久女警 | 国产一区二区三区网站 | 欧美性生活免费视频 | 99ri在线| 国产精品美女久久久免费 | 中国a级黄色片 | 亚洲精品动漫在线观看 | 色诱亚洲精品久久久久久 | 激情国产视频 | 一区二区三区视频在线播放 | 午夜视频在线免费播放 | 久久久久久久一区 | 国产午夜精品久久久久久久蜜臀 | 国产精品99久久久久久大便 | 日韩精品中文字幕在线观看 | 特大黑人videos与另类娇小 |