package com.nevin.SMSender;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.ProgressBar;
public class DaysActivity extends Activity {
private ImageView loadingImage1 = null;
private ImageView loadingImage2 = null;
private Handler myHandler = new Handler();
private ProgressBar pgBar = null;
AnimationSet animationSet1;
AnimationSet animationSet2;
int i = 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
loadingImage1 = (ImageView) findViewById(R.id.loadingImage1);
loadingImage2 = (ImageView) findViewById(R.id.loadingImage2);
pgBar = (ProgressBar) findViewById(R.id.theProgressBar);
// 第一个动画
animationSet1 = new AnimationSet(true);
TranslateAnimation translateAnimation1 = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF,
-1f, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 0f);
translateAnimation1.setDuration(2000);
AlphaAnimation alphaAnimation1 = new AlphaAnimation(1, 0);
alphaAnimation1.setDuration(2800);
animationSet1.addAnimation(translateAnimation1);
animationSet1.addAnimation(alphaAnimation1);
// 第二个动画
animationSet2 = new AnimationSet(true);
TranslateAnimation translateAnimation2 = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF,
-1.17f, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 0f);
translateAnimation2.setDuration(3000);
AlphaAnimation alphaAnimation2 = new AlphaAnimation(0, 1);
alphaAnimation2.setDuration(3000);
animationSet2.addAnimation(translateAnimation2);
animationSet2.addAnimation(alphaAnimation2);
// 开始播放
// loadingImage1.startAnimation(animationSet1);
// loadingImage2.startAnimation(animationSet2);
myHandler.post(myThread);
}
Runnable myThread = new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if (i == 7) {
i=0;
loadingImage2.setImageDrawable(getResources().getDrawable(
R.drawable.monday));
//myHandler.removeCallbacks(myThread);
//return;//可以从这里跳到你需要的Activity
} else {
switch (i) {
case 1:
loadingImage1.setImageDrawable(getResources().getDrawable(
R.drawable.monday));
loadingImage2.setImageDrawable(getResources().getDrawable(
R.drawable.tuesday));
break;
case 2:
loadingImage1.setImageDrawable(getResources().getDrawable(
R.drawable.tuesday));
loadingImage2.setImageDrawable(getResources().getDrawable(
R.drawable.wednesday));
break;
case 3:
loadingImage1.setImageDrawable(getResources().getDrawable(
R.drawable.wednesday));
loadingImage2.setImageDrawable(getResources().getDrawable(
R.drawable.thursday));
break;
case 4:
loadingImage1.setImageDrawable(getResources().getDrawable(
R.drawable.thursday));
loadingImage2.setImageDrawable(getResources().getDrawable(
R.drawable.friday));
break;
case 5:
loadingImage1.setImageDrawable(getResources().getDrawable(
R.drawable.friday));
loadingImage2.setImageDrawable(getResources().getDrawable(
R.drawable.saturdayandsunday));
break;
}
if (i != 6) {
loadingImage1.startAnimation(animationSet1);
loadingImage2.startAnimation(animationSet2);
} else {
loadingImage1.setImageDrawable(getResources().getDrawable(
R.drawable.saturdayandsunday));
}
i = i + 1;
}
if ( i==0 || i==1 ){
pgBar.setProgress(0);
} else if (i == 2) {
pgBar.setProgress(5);
} else {
pgBar.setProgress((i + 3) * 10);
}
if(i!=7)
{
myHandler.postDelayed(myThread, 3000);
}
else
{
myHandler.postDelayed(myThread, 1000);
}
}
};
}
Android应用源码之Android Layout UI 首页加载过渡动画,星期变化动画-IT计算机-毕业设计.zip
版权申诉
29 浏览量
2022-04-06
20:45:17
上传
评论
收藏 451KB ZIP 举报
芝麻粒儿
- 粉丝: 6w+
- 资源: 2万+
最新资源
- 基于C++的二叉树的创建与遍历(免费提供源码)
- AEB算法模型matlab版本
- Screenshot_2024-05-28-00-07-11-51_a935a6faaffa07c582f2c3acde62ae6b.jpg
- 1-230201111535.zip
- 《DAX 底层计算过程演示-ADDCOLUMNS + 复杂上下文环境》配套数据文件
- ruc-波兰表达式c语言递归demo笔记
- Java.md
- credit-visualstudio2022笔记
- SystemServer启动阶段思维示意图
- 168832737737857��Ϊ�˶�����-14.1.4.171-wearBeta-390-lspatched.apk
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈