在splash页面添加AlphaAnimation透明度渐变动画效果
来源:互联网 发布:c语言程序调试步骤 编辑:程序博客网 时间:2024/05/01 20:40
1、要求:
比方说我想在splash页面添加一个过渡动画,可以使用AlphaAnimation透明度渐变动画效果,复写其中的监听事件可以做到当动画结束时,跳转到指定activity页面,比方说下面就是几行示例代码:
public class SplashActivity extends BaseActivity {
/* 标识 */
protected static final String TAG = "SplashActivity";
private RelativeLayout rl_splash;
@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.activity_splash);
rl_splash = (RelativeLayout) findViewById(R.id.rl_splash);
//使用AlphaAnimation动画效果,设置的是透明度度的渐变动画
AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
alphaAnimation.setDuration(2000);
rl_splash.startAnimation(alphaAnimation);
alphaAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
//动画结束时,进入登陆页面,结束当前页面
@Override
public void onAnimationEnd(Animation animation) {
jumpToLogin();
finish();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
//进入登陆页面的方法
protected void jumpToLogin() {
Intent intent = new Intent(this,LoginActivity.class);
startActivity(intent);
}
}
比方说我想在splash页面添加一个过渡动画,可以使用AlphaAnimation透明度渐变动画效果,复写其中的监听事件可以做到当动画结束时,跳转到指定activity页面,比方说下面就是几行示例代码:
public class SplashActivity extends BaseActivity {
/* 标识 */
protected static final String TAG = "SplashActivity";
private RelativeLayout rl_splash;
@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.activity_splash);
rl_splash = (RelativeLayout) findViewById(R.id.rl_splash);
//使用AlphaAnimation动画效果,设置的是透明度度的渐变动画
AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
alphaAnimation.setDuration(2000);
rl_splash.startAnimation(alphaAnimation);
alphaAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
//动画结束时,进入登陆页面,结束当前页面
@Override
public void onAnimationEnd(Animation animation) {
jumpToLogin();
finish();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
//进入登陆页面的方法
protected void jumpToLogin() {
Intent intent = new Intent(this,LoginActivity.class);
startActivity(intent);
}
}
0 0
- 在splash页面添加AlphaAnimation透明度渐变动画效果
- Android动画 之 Tween Animation(AlphaAnimation 透明度渐变)
- AlphaAnimation渐变动画Demo
- Android 动画 - AlphaAnimation渐变动画
- AlphaAnimation动画效果
- 安卓中为View添加动画效果(尺寸缩放、透明度渐变、旋转、移动)
- Android 动画之AlphaAnimation应用详解(透明度动画效果)转载
- Animation动画之AlphaAnimation(透明度变化)
- 动画效果:位置移动、画面旋转、渐变透明度、渐变尺寸缩放
- 【Android动画九章】-AlphaAnimation(渐变动画)
- 补间动画详解二 渐变动画AlphaAnimation
- 设置动画的透明度,透明度的渐变
- Android-alpha-渐变透明度 动画
- Android开场透明度渐变动画
- 在状态栏上做渐变动画效果
- 控件渐变式显示和消失动画,AlphaAnimation
- Android 图片合成:添加蒙板效果 不规则相框 透明度渐变效果的实现
- Android 图片合成:添加蒙板效果 不规则相框 透明度渐变效果的实现
- iOS开发之AFNetworking使用
- Ubuntu无法挂载NTFS硬盘或移动硬盘的问题
- Tomcat 性能优化
- WebService:SOAP及协议的监控
- windows窗口程序输出printf打印信息
- 在splash页面添加AlphaAnimation透明度渐变动画效果
- Maven导出jar包
- 【taobaoUED】CSS 与 HTML5 响应式图片
- 安卓学习之路2之Android项目结构介绍
- java基础之IO技术_1
- ios开发不能错过的xcode插件
- LeetCode - 58. Length of Last Word
- C#编程语言
- Activity的生命周期