(Touch Android) 新浪微博Android客户端开发第一篇:Logo 页面的实现

这是一个简单的Logo页面。功能也就是展示一下Logo而已偷笑。先看一下页面效果吧。

 

 

 

 

先说一下页面布局:有一个绿色的背景,正中间有一个新浪的Logo图标。这个Logo会由浅入深的一个动画变化。动画结束后会跳转到登陆页面。

 

下面我们就先看布局文件:

 

<?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:background="@drawable/main_bg"
  android:gravity="center"
  >
  
  <ImageView android:id="@+id/img_logo"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:src="@drawable/logo_bg"/>
  
</LinearLayout>


以上就是布局文件的代码,相当相当的简单。

 

继续看Java代码

 

 

package com.droidstouch.iweibo.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;

import com.droidstouch.iweibo.R;

public class LogoActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        
      //设置全屏
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);
        
        setContentView(R.layout.logo);
        
        
        AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);
        animation.setDuration(3000);
        
        ImageView img_logo = (ImageView) this.findViewById(R.id.img_logo);
        img_logo.setAnimation(animation);
        
        
        animation.setAnimationListener(new AnimationListener(){

			public void onAnimationEnd(Animation animation)
			{

				 Intent intent = new Intent(LogoActivity.this, LoginActivity.class);
			     startActivity(intent);
			}

			public void onAnimationRepeat(Animation animation)
			{
				// TODO Auto-generated method stub
				
			}

			public void onAnimationStart(Animation animation)
			{
				// TODO Auto-generated method stub
				
			}});
        
       
        
    }
}


 

Java代码中呢,用到了两个知识点。可以参考(Android全屏设置的两种方式)和(android Animation 动画效果介绍

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值