android从零开始-闪屏页
来源:互联网 发布:linux pwd命令 编辑:程序博客网 时间:2024/06/06 03:44
进入app的第一个页面一般都是闪屏页,用于检查更新,初始化各种数据等。闪屏页展示一张图片(例如公司logo、版本信息),为了使闪屏页更加炫酷,一般都会加上几种动画效果(旋转、缩放、渐变)。
今天先贴下简单闪屏页的代码:
public class SplashActivity extends AppCompatActivity implements Animation.AnimationListener { private ImageView mSplashIv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); mSplashIv = (ImageView) findViewById(R.id.splash_iv); initViews(); } private void initViews() { // 动画集合 AnimationSet set = new AnimationSet(false); // 旋转动画 RotateAnimation ra = new RotateAnimation(0, -360, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); ra.setDuration(1000); ra.setFillAfter(true); // 缩放动画 ScaleAnimation sa = new ScaleAnimation(0,1,0,1,ScaleAnimation.RELATIVE_TO_SELF,0.5f,ScaleAnimation.RELATIVE_TO_SELF,0.5f); sa.setDuration(1000); sa.setFillAfter(true); // 渐变动画 AlphaAnimation aa = new AlphaAnimation(0,1); aa.setDuration(1000); aa.setFillAfter(true); set.addAnimation(ra); set.addAnimation(sa); set.addAnimation(aa); mSplashIv.startAnimation(set); set.setAnimationListener(this); } /* * 动画开始监听 */ @Override public void onAnimationStart(Animation animation) { } /* * 动画结束监听,跳转到引导页(首页) */ @Override public void onAnimationEnd(Animation animation) { startActivity(new Intent(this,IndexActiviy.class)); finish(); } /* * 动画重复监听 */ @Override public void onAnimationRepeat(Animation animation) { }
0 0
- android从零开始-闪屏页
- Android从零开始
- Android从零开始
- Android 从零开始
- Android 从零开始
- 【Android】从零开始
- 从零开始Android
- Android从零开始
- 从零开始学Android
- 从零开始学习android
- android开发从零开始
- Android开发从零开始
- Android从零开始(十二)
- Android从零开始(十二)
- Android从零开始(十一)
- Android从零开始(三)
- 从零开始学Android - 引子
- Android开发从零开始
- 如何在ti官网查找官方例程及官方提供的资料
- 如何一步步攻破一家互联网公司的
- Add-on Table ‘Enhancement category for table missing’ 警告解决
- 210. Course Schedule II【M】【7】
- an internal error occurred during building workspace 错误
- android从零开始-闪屏页
- jQuery EasyUI filebox的文件路径错误
- Awesome .NET!
- centos import MySQLdb 报错!
- 对数据库的访问 都放在单独的dll中
- JScrollPane FlowLayout组合显示单行解决方法
- js常用事件总结及案例-onMouseOver、onMouseOut
- java通过URL读取json数据
- 一个由于撩妹而设计出来的C/C++程序