Android APP 开始的动画效果
来源:互联网 发布:湘北vs山王球员数据 编辑:程序博客网 时间:2024/06/10 23:58
一般的APP 在启动的时候都有一个欢迎页面,看起来非常的高大上,而且很绚丽,本篇讲述一个使用渐变效果的开始页面
首先是布局页面,这儿我在上面放了一个关闭按钮,有的人可能不喜欢这个动画,就可以关闭,直接进入APP
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/start_background"
android:gravity="bottom"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/start_background"
android:layout_weight="1.00" >
<ImageButton
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="18dp"
android:layout_marginTop="18dp"
android:background="#00000000"
android:src="@drawable/abc_ic_clear_mtrl_alpha" />
</RelativeLayout>
</LinearLayout>
布局完成就设置它的事件,设定一个时间让欢迎页面展示,展示 晚了就关闭这个Activity并启动指定的Activity
package com.example.show;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageButton;
public class StartActivity extends Activity implements OnClickListener
{
private ImageButton btn_close;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final View view = View.inflate(this, R.layout.start, null);
setContentView(view);
btn_close = (ImageButton) findViewById(R.id.btn_close);
btn_close.setOnClickListener(this);
//渐变展示启动屏
AlphaAnimation start = new AlphaAnimation(0.3f,1.0f);
start.setDuration(5000);
view.startAnimation(start);
start.setAnimationListener(new AnimationListener()
{
@Override
public void onAnimationEnd(Animation arg0) {
redirectTo();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationStart(Animation animation) {}
});
}
/**
* 跳转到...
*/
private void redirectTo()
{
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
@Override
public void onClick(View v)
{
if (v.getId() == R.id.btn_close)
{
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
}
- Android APP 开始的动画效果
- 用动画实现android app启动界面的渐变效果
- Android动画效果集合开源APP
- android直播app礼物连击动画效果
- Android ProgressBar的动画效果
- Android 等待的动画效果
- Android ViewPager的动画效果
- android的动画效果Animation
- 好看的android动画效果
- Android波浪动态图(仿百度外卖、淘宝app用户界面用到的动画效果)
- Android开发中App演示Gif效果动画的制作过程详讲
- 带动画效果,点击开始倒计时的按钮
- 直播APP常用动画效果
- wince如何去掉APP窗口的动画显示效果
- 介绍简单实用APP动画效果的两个关键
- 介绍简单实用APP动画效果的两个关键
- 设置整体App页面跳转的动画效果
- 实现APP进入登录界面之前的动画效果
- 使用fstream时,提示未定义的标识符
- apache olut oauth2 (server、client)集成配置
- 【BZOJ1318】[Spoj744] Longest Permutation【杂项】
- 关于u3d中需要注意一些地方
- const、static变量存放位置
- Android APP 开始的动画效果
- 解决下拉刷新偏移
- 服务注册问题--未能加载文件和程序集
- POJ Area 1265(pick定理)
- 自动化测试关键字驱动的原理及实现
- First Blood
- ios TableView性能优化技巧
- 终于,零基础也能把App做的风生水起
- 生日了,总要写点什么