Android 载入动画Splash的几种运用
来源:互联网 发布:软件实施实习心得体会 编辑:程序博客网 时间:2024/05/01 23:55
创建一个Handler.postDelayed,延迟2秒或者更多,之后切换到
另一ACTIVITY界面.
new Handler().postDelayed(new Runnable()
{
@Override
public void run()
{
// TODO Auto-generated method stub
Intent it = new Intent(Splash.this, Youban1Activity.class);
startActivity(it);
finish();
}
}, 2000);
}
--------------加入动画
Animation mAnimation = AnimationUtils.loadAnimation(this,
R.anim.scaleanimation);
则先播放动画后切换到另一AVTIVITY界面
--------------------------
package youbanwang.co.cc;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
new Handler().postDelayed(new Runnable()
{
@Override
public void run()
{
// TODO Auto-generated method stub
Intent it = new Intent(Splash.this, Youban1Activity.class);
startActivity(it);
finish();
}
}, 2000);
}
}
------------------自动展示图片SPLASH
package tangshi.co.cc;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;
public class Splash extends Activity {
private ImageView mImageView;
private Handler mHandler;
private final int SPLASH1 = 0;
private final int SPLASH2 = 1;
private final int SPLASH3 = 2;
private final int TURNTOLOGIN = 3;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
mImageView = (ImageView) findViewById(R.id.imageView1);
mImageView.setImageResource(R.drawable.icon1);
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
switch (msg.what) {
case SPLASH1:
mImageView.setImageResource(R.drawable.icon1);
break;
case SPLASH2:
mImageView.setImageResource(R.drawable.icon2);
break;
case SPLASH3:
mImageView.setImageResource(R.drawable.icon3);
break;
case TURNTOLOGIN:
mImageView.setImageResource(R.drawable.icon4);
break;
default:
break;
}
};
};
new Thread() {
public void run() {
try {
sleep(1000);
mHandler.sendEmptyMessageDelayed(SPLASH1, 0);
sleep(1000);
mHandler.sendEmptyMessageDelayed(SPLASH2, 0);
Thread.sleep(1000);
mHandler.sendEmptyMessageDelayed(SPLASH3, 0);
sleep(2000);
mHandler.sendEmptyMessageDelayed(TURNTOLOGIN, 0);
} catch (Exception e) {
// TODO: handle exception
} finally {
Intent intent = new Intent(Splash.this,
HahamxActivity.class);
startActivity(intent);
finish();
}
};
}.start();
}
}
---------Splash animation
package gongzibai.co.cc;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
public class Splash extends Activity {
private ImageView mImageView;
private TextView mTextView;
Animation animation;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash1);
mImageView = (ImageView) findViewById(R.id.imageView1);
mTextView=(TextView)findViewById(R.id.textView1);
Animation mAnimation = AnimationUtils.loadAnimation(this,
R.anim.scaleanimation);
mImageView.startAnimation(mAnimation);
mTextView.startAnimation(mAnimation);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
Intent it = new Intent(Splash.this, RandomActivity.class);
startActivity(it);
finish();
}
}, 2000);
}
}
---------anim
<?xml version="1.0" encoding="UTF-8"?>
<set android:shareInterpolator="false" xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="3000"
></alpha>
</set>
- Android 载入动画Splash的几种运用
- android开场动画splash的实现
- 基于android的Splash欢迎动画
- android的几种动画
- Android带平移动画的Splash界面Demo
- Android 动画特效的运用
- Android实用视图动画及工具系列之一:简单的载入视图和载入动画
- android的Splash Screen
- 【Android】Splash的使用
- android的那几种动画
- android动画的几种形式
- 几种常见载入
- Android 的ScaleAnimation 缩放动画基本运用
- android几种动画分析
- android几种动画分析
- android几种动画分析
- android 几种动画介绍
- android的splash启动画面
- 真正要治理的是那些无良的老师和学校
- 嵌入式Linux启动配置文件及脚本
- HttpURLConnection API 使用手册
- 坐标转换问题-转载
- Rexsee入门视频:在线创建Android应用Hello World程序
- Android 载入动画Splash的几种运用
- MongoDB学习文档
- 如何去掉XP欢迎屏幕之前的提示窗口?不是系统提示信息。
- Windows下多线程编程技术及其实现
- EBS xml publisher中文乱码
- jquery选择器的简单应用
- sql语句 时间段 内 重复 语句
- OpenCV编程——IplImage类型
- Calendar加上2天