赵雅智_splash启动界面
来源:互联网 发布:淘宝买家退货调包 编辑:程序博客网 时间:2024/04/29 07:09
项目需求
设置初始化界面并实现界面跳转
步骤
- 启动界面主题设置为全屏
- 设置背景资源
- 实现开启动画和跳转
实现效果
具体代码
style.xml
<resources> <style name="AppBaseTheme" parent="android:Theme.Light"> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> </style> <style name="theme"> <item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">?android:windowNoTitle</item> </style></resources>
splash.xml
<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true" > <item android:drawable="@drawable/a1" android:duration="1000"></item> <item android:drawable="@drawable/a2" android:duration="1000"></item> <item android:drawable="@drawable/a3" android:duration="1000"></item> <item android:drawable="@drawable/a4" android:duration="1000"></item> <item android:drawable="@drawable/a5" android:duration="1000"></item> <item android:drawable="@drawable/a6" android:duration="1000"></item> </animation-list>
activity_splash.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${packageName}.${activityClass}" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" /></RelativeLayout>
activty_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${packageName}.${activityClass}" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /></RelativeLayout>
SplashActivity.java
package com.example.android_splash;import android.app.Activity;import android.content.Intent;import android.graphics.drawable.AnimationDrawable;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.widget.ImageView;public class SplashActivity extends Activity {private ImageView ivSplash;private AnimationDrawable animationDrawable;public static final int SPLASH = 1;public static final int DELAYANIM = 0;private Handler handler = new Handler() {public void handleMessage(Message msg) {switch (msg.what) {case DELAYANIM:animationDrawable.start();break;case SPLASH:Intent intent = new Intent();intent.setClass(getApplicationContext(), MainActivity.class);startActivity(intent);finish();break;default:break;}};};@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_splash);ivSplash = (ImageView) findViewById(R.id.imageView1);// 设置背景资源ivSplash.setBackgroundResource(R.drawable.splash);// 获取动画对象animationDrawable = (AnimationDrawable) ivSplash.getBackground();// 开启动画handler.sendEmptyMessageDelayed(DELAYANIM, 1000);// 跳转handler.sendEmptyMessageDelayed(SPLASH, 6000);}}
MainActivity.java
package com.example.android_splash;import android.app.Activity;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);}}
0 0
- 赵雅智_splash启动界面
- 1.1 _splash界面的UI
- android手机卫士开发_splash界面
- android进阶阶段01_Splash界面
- android开发之提高应用启动速度_splash页面瞬间响应_避免APP启动闪白屏
- android开发之提高应用启动速度_splash页面瞬间响应_避免APP启动闪白屏
- android开发之提高应用启动速度_splash页面瞬间响应_避免APP启动闪白屏
- android开发之提高应用启动速度_splash页面瞬间响应_避免APP启动闪白屏
- android开发之提高应用启动速度_splash页面瞬间响应_避免APP启动闪白屏
- android提高应用启动速度_splash页面瞬间响应_避免APP启动闪白屏
- android开发之提高应用启动速度_splash页面瞬间响应_避免APP启动闪白屏
- 启动界面
- 启动界面
- 启动界面
- 如何制作启动界面
- 制作启动界面
- 启动Hsql管理界面
- 定制android启动界面
- linux C++ 的内存分布情况
- 集合重新hashcode()和equals()方法
- CentOS调整var/home分配的空间 (Logical Volume), 1and1实体主机必做!
- hibernate
- 防止弹框移出界面 覆盖easyui方法 $.fn.panel.defaults.onMove
- 赵雅智_splash启动界面
- PIG安装配置及案例应用
- ARM处理器NEON编程及优化技巧二—处理剩余的元素
- ubuntu11.10升级到12.04 的过程,并且更新源
- crm plugin连接不上
- 涣忻撬弥嗡悍崭链资瓷撇浅逞止怕
- 姓逊倌栽腔统谮倍吵恼谱袒虾觅鞍
- select语句执行顺序
- 拙勇姓频适再胖茁鬃短颖琅抖瘸悦