android基础---简易闪屏操作,通过动画实现
来源:互联网 发布:linux查看git服务 编辑:程序博客网 时间:2024/06/05 03:00
1.通过动画的渐变效果,将图片进行变化,设置一个漂亮的跳转!!!
Splash.java:
public class Splash extends Activity {
private ImageView iv_splash;Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
//隐藏标题栏与全屏显示
this.requestWindowFeature(Window.FEATURE_NO_TITLE);this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.splash);
iv_splash=(ImageView) findViewById(R.id.iv_splash);
//初始化动画
AlphaAnimation animation=new AlphaAnimation(0.1f, 1.0f);
//设置动画运行的时间
animation.setDuration(3000);
//将动画加载到图片中
iv_splash.setAnimation(animation);animation.setAnimationListener(new AnimationListener() {
/
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
//动画结束时进行的操作
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
intent=new Intent(Splash.this, MainActivity.class);
startActivity(intent);
finish();
}
});
}
//可以通过触摸事件来结束动画
@Overridepublic boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
super.onTouchEvent(event);
intent=new Intent(Splash.this, MainActivity.class);
startActivity(intent);
finish();
return true;
}
2.布局文件:splash.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/iv_splash"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/a6"
android:scaleType="fitXY"
/>
</LinearLayout>
- android基础---简易闪屏操作,通过动画实现
- 简易动画的实现
- Android动画简易收录
- android中通过AnimationDrawable实现动画背景图片
- 通过AnimationDrawable实现android中的帧动画
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- 【Android 基础】Animation 动画介绍和实现
- Android基础动画实现和剖析
- <转>Java Socket常见异常处理
- 数据结构 线性表之链表
- ORACLE表空间介绍
- POJ 1860 Currency Exchange
- 模拟json数据动态数据库遍历到table表格里
- android基础---简易闪屏操作,通过动画实现
- Xcode工程创建view
- [Android问答] px、dp和sp,这些单位有什么区别?
- 高并发 sql 生成不重复编号 (订单号) & 如何在高并发分布式系统中生成全局唯一Id
- ArcGIS中输出指定比例尺图片
- struts2的拦截器及实现
- 蛋蛋的伤不起
- 第三周第二章
- ListView设置emptyView的限制