1、登录步骤
Logo ----> Login -----> Main
2、代码
2.1 Logo的实现
xml:
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/fscreen"
>
android:id="@+id/logo_bg"
android:src="@drawable/logo_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Code:
package com.itcast.ui; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; import android.widget.ImageView; /** * 欢迎页 * @author tomatos.to * */ public class LogoActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 全屏显示 // 1.去标题 this.requestWindowFeature(Window.FEATURE_NO_TITLE); // 2.全屏设置 this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.log); ImageView iv = (ImageView) findViewById(R.id.logo_bg); // 设置淡入淡出的动画效果 AlphaAnimation aa = new AlphaAnimation(0.1f, 1.0f); // 设置动画的持续时间为3s aa.setDuration(3000); // 开始播放动画 iv.startAnimation(aa); // 当动画执行完后,启动LoginActivity aa.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { Intent it = new Intent(LogoActivity.this, LoginActivity.class); startActivity(it); } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } }); } }