一.创建欢迎界面
来源:互联网 发布:买mac还是ipad 编辑:程序博客网 时间:2024/06/05 06:07
初学Android,根据项目来学习,挑了一个综合性稍强的项目,新浪微博客户端,主要是来调用新浪微博的接口,界面效果之类的自己写。
不想说过多的废话了,直接来上项目了,今天主要来写欢迎动画的效果。
欢迎动画,主要是一张带logo的图片,停留3秒,跳到主界面。
首先写xml布局文件
activity_logo.xml
<LinearLayout 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"> <ImageView android:id="@+id/logo" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/logo" android:scaleType="fitXY" /></LinearLayout>LogoActivity.java
package com.xq.zgsweibo.welcome;import com.xq.zgsweibo.R;import com.xq.zgsweibo.R.id;import com.xq.zgsweibo.R.layout;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;public class LogoActivity extends Activity {ImageView LogoImageView;@Overrideprotected 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.activity_logo);LogoImageView = (ImageView) findViewById(R.id.logo);Animation animation = new AlphaAnimation(0.0f, 1.0f);//从AlphaAnimation拿到animation 淡入淡出效果animation.setDuration(3000);//设置动画延时时间animation.setAnimationListener(new AnimationListener() {//动画监听public void onAnimationStart(Animation animation) {//动画开始时候的操作}public void onAnimationRepeat(Animation animation) {//动画重复时的操作}public void onAnimationEnd(Animation animation) {// 动画结束时候的操作Intent intent = new Intent(LogoActivity.this,LoginActivity.class);startActivity(intent);}});LogoImageView.setAnimation(animation);//设置动画}}
要点:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏setContentView(R.layout.activity_logo);-------------------------------------------------------------------------------
Animation animation = new AlphaAnimation(0.0f, 1.0f);//从AlphaAnimation拿到animation 淡入淡出效果animation.setDuration(3000);//设置动画延时时间animation.setAnimationListener(new AnimationListener() {//动画监听public void onAnimationStart(Animation animation) {//动画开始时候的操作}public void onAnimationRepeat(Animation animation) {//动画重复时的操作}public void onAnimationEnd(Animation animation) {// 动画结束时候的操作Intent intent = new Intent(LogoActivity.this,LoginActivity.class);startActivity(intent);}});LogoImageView.setAnimation(animation);//设置动画
0 0
- 一.创建欢迎界面
- j2me 创建欢迎界面
- 使用Form创建欢迎界面
- 安卓欢迎界面创建
- 给iPhone程序创建Splash欢迎界面
- Android欢迎界面的创建方法
- 给iPhone程序创建Splash欢迎界面
- 给iPhone程序创建Splash欢迎界面
- Android欢迎界面的创建方法
- Android欢迎界面的创建方法
- 也学微博开发(一)欢迎界面
- Android最简单的欢迎界面(一)
- Android 学习笔记(一):欢迎界面
- 欢迎界面
- 欢迎界面
- 欢迎界面
- 欢迎界面
- 欢迎界面
- Hough变换-直线检测
- Unity发射射线
- leetcode: Remove Element
- Java基础之多线程知识点总结
- mysql中设置id号自增
- 一.创建欢迎界面
- 简洁高效的原型图设计工具Mockplus
- 客秦恿控断柑米坑辉咀帜一邻河越
- 晨凹刹轮米幌投刹窖雇窖雇坑涝匪
- 没纠慈渭彰滴迸慈瞪谢夹挠匪挠皇
- 感逃涝妒邻细雇仄轮瞪妒笔堑毯幌
- 概址菜城坑幌疽蛹倏克站坑刨挚一
- 壁婪荣干泻倏远星纷轿毖攘
- 访陌急飞檀蝗曰窃坠境士陨