Android开发之启动页面Splash Screen
来源:互联网 发布:封闭式小区 知乎 编辑:程序博客网 时间:2024/05/16 14:31
简介:使用view动画(透明度动画,AlphaAnimation)实现启动页面Splash Screen。View动画的四种变化效果对应着Animation的四个子类:TranslateAnimation、ScaleAnimation、RotateAnimation和AlphaAnimation。四种动画可以用xml和代码控制。
一.页面的布局(activity_splash.xml)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white"> <ImageView android:id="@+id/iv_splash" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scaleType="fitXY"/></RelativeLayout>使用以上布局来显示启动页的图片。
二.activity来展示动画
1.首先创建View对象
View view = getLayoutInflater().inflate(R.layout.activity_splash,null);
2.新建动画,为当前view设置动画
AlphaAnimation animation = new AlphaAnimation(0.3f, 1.0f);//第一个参数表示起始透明度,第二个参数表示完全不透明animation.setDuration(1000);//持续时间animation.setAnimationListener(new AnimationListener() {@Overridepublic void onAnimationStart(Animation animation) {}@Overridepublic void onAnimationRepeat(Animation animation) {}@Overridepublic void onAnimationEnd(Animation animation) {;// 动画结束后,可以做一些相应操作}});view.setAnimation(animation);
3.为activity设置视图
setContentView(view);
0 0
- Android开发之启动页面Splash Screen
- Android 启动页面制作(Splash Screen)
- android开发之应用splash screen
- Android开发之提高应用启动速度splash页面瞬间响应 避免APP启动闪白屏
- 【Android Studio】制作启动画面Splash Screen
- 【Android Studio】制作启动画面Splash Screen
- android 启动屏幕 ==> splash screen
- 启动画面(splash screen)
- Android启动页面设置Splash
- android的Splash Screen
- Android 开发之 Splash 页面 3 秒跳转
- Android开发之splash界面
- Android之启动界面之Splash总结
- Android开发笔记--制作启动界面splash
- Android开发笔记--制作启动界面splash
- Android性能优化之Splash页面设计
- Android性能优化之提高App启动速度和Splash页面设计
- android程序启动画面之Splash总结
- UVA 11388 GCD LCM
- 安卓数据保存,保存到文件(转自安卓官方培训中文版)
- linux下查看tcp连接的几种方式
- nyoj 420(快速幂)
- 简单的抽屉效果
- Android开发之启动页面Splash Screen
- 什么是 Landing Page?
- 如何优化cocos2d程序的内存使用和程序大小:第一部分
- 结构体和NSValue的转换
- Data Binding & Espresso: IllegalAccessError: Class ref in pre-verified class resolved to unexpected
- 关于dialog出现not attached to window manager问题深入分析
- VideoView小试牛刀
- SPOJ SUBST1 New Distinct Substrings
- Lua 在C程序中调用Lua函数