起始页-旋转动画效果
来源:互联网 发布:java int除法向上取整 编辑:程序博客网 时间:2024/06/06 17:08
五块钱在某宝上买到的android教学视频,如获武林秘籍啊~让我最为佩服的教学视频中对软件的架构能力,纯记录和学习,涉及版权勿喷~
起始页是一个旋转动画效果:
知识点:
1 RelativeLayout
2 ImageView
3 Animation动画设置
4 sharedpreferences轻量级储存数据方式
布局方式使用的是RelativieLayout布局,将“小马”图像压在红色背景图上。
Activity_splash.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/rl_root" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/splash_bg_newyear" android:gravity="top" > <ImageView android:id="@+id/image1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@drawable/splash_horse_newyear" /></RelativeLayout>
步骤
1 获取布局id
2 设置动画效果
package com.example.zhihuibj;import android.app.Activity;import android.content.Intent;import android.content.SharedPreferences;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.view.animation.AlphaAnimation;import android.view.animation.Animation;import android.view.animation.Animation.AnimationListener;import android.view.animation.AnimationSet;import android.view.animation.RotateAnimation;import android.view.animation.ScaleAnimation;import android.widget.RelativeLayout;public class SplashActivity extends Activity {RelativeLayout rlRoot;//获取RelativeLayout布局@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_splash);rlRoot=(RelativeLayout)findViewById(R.id.rl_root);startAnima();}private void startAnima(){//动画集合AnimationSet set = new AnimationSet(false);//旋转效果RotateAnimation rotate =new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);rotate.setDuration(5000);rotate.setFillAfter(true);//缩放ScaleAnimation scale= new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);scale.setDuration(5000);scale.setFillAfter(true);//渐变AlphaAnimation alpha = new AlphaAnimation(0, 1);alpha.setDuration(5000);alpha.setFillAfter(true);set.addAnimation(rotate);set.addAnimation(scale);set.addAnimation(alpha);//设置动画监听set.setAnimationListener(new AnimationListener() {@Overridepublic void onAnimationStart(Animation animation) {// TODO Auto-generated method stub}@Overridepublic void onAnimationRepeat(Animation animation) {// TODO Auto-generated method stub}@Overridepublic void onAnimationEnd(Animation animation) {jumpNextPage();}});rlRoot.startAnimation(set);//给布局添加动画}//设置导航页只显示一次private void jumpNextPage(){//轻量级储存数据的方式sharedpreferencesSharedPreferences sp = getSharedPreferences("config", MODE_PRIVATE);boolean userGuide =sp.getBoolean("is_user_guide_showed", false);if(!userGuide){startActivity(new Intent(SplashActivity.this,GuideActivity.class));}else{startActivity(new Intent(SplashActivity.this,MainActivity.class));}finish();}}
0 0
- 起始页-旋转动画效果
- Android 动画旋转效果
- 控件旋转动画效果
- Silverlight 旋转动画效果
- Silverlight 动画效果1 -- 旋转
- android 匀速旋转动画效果
- 围绕中心旋转动画效果
- CSS3绚丽旋转动画效果
- Android 3D旋转动画效果
- android 实现控件的旋转动画效果
- js实现菜单栏上下旋转动画效果
- Android 3D旋转动画效果
- android 实现3D动画旋转效果
- Android 3D旋转动画效果
- android 布局实现旋转动画效果
- android下Rotate旋转动画实现效果
- android 实现控件的旋转动画效果
- Android 3D旋转动画效果
- ubuntu修改hosts文件 跳过DNS解析实现服务器定向登录(google,FB,TW等)
- leetcode:word break II
- 每日一篇:判断水仙花数。
- 用opencv做棋盘格的标定
- RFID扫描APP--source3
- 起始页-旋转动画效果
- 安卓学习记录-java-day1
- 实现图片加文字简介的两种方式
- USACO1.1 PROB Your Ride Is Here 比较分析
- PBOC3.0 SM2 算法各种证书、数字签名的验证
- SurfaceView
- iOS开发--Block容易造成循环引用
- dom4j之xpath
- 苹果官方电池保护壳 让iPhone 6怀孕一只4S