码迷,mamicode.com
首页 > 其他好文 > 详细

欢迎界面旋转进入

时间:2018-07-25 13:16:59      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:xtend   find   tac   ==   apk   package   rmi   contex   edr   

技术分享图片

 



<
RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rl_welcome_root" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" tools:context="${relativePackage}.${activityClass}" > <ProgressBar android:id="@+id/pb_welcome_loading" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" android:layout_marginBottom="50dp" android:indeterminateDrawable="@anim/image_progress" android:indeterminateDuration="700"/> <TextView android:id="@+id/tv_welcome_version" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_above="@id/pb_welcome_loading" android:layout_marginBottom="10dp" android:text="当前版本: 1.0" android:textSize="20sp" /> </RelativeLayout>

image_progress.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/progess" >

</rotate>

public class WelcomeActivity extends Activity {

    private RelativeLayout rl_welcome_root;
    private Handler handler  = new Handler(){
        public void handleMessage(android.os.Message msg) {
            if(msg.what==1) {
                startActivity(new Intent(WelcomeActivity.this, SetupGuide1Activity.class));
                //关闭自己
                finish();
            }
        }
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        
        rl_welcome_root = (RelativeLayout) findViewById(R.id.rl_welcome_root);
        
        //显示动画
        showAnimation();
        
        //发送延迟3s的消息
        handler.sendEmptyMessageDelayed(1, 3000);
    }

    /**
     * 显示动画
     * 
     * 旋转动画  RotateAnimation: 0-->360 视图的中心点 2s
     * 透明度动画 AlphaAnimation: 0-->1 2s
     * 缩放动画 ScaleAnimation: 0-->1 视图的中心点 2s
     */
    private void showAnimation() {
        //旋转动画  RotateAnimation: 0-->360 视图的中心点 2s
        RotateAnimation rotateAnimation = new RotateAnimation(0, 360, 
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        rotateAnimation.setDuration(2000);
        //透明度动画 AlphaAnimation: 0-->1 2s
        AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
        alphaAnimation.setDuration(2000);
        //缩放动画 ScaleAnimation: 0-->1 视图的中心点 2s
        ScaleAnimation scaleAnimation = new ScaleAnimation(0, 1, 0, 1,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(2000);
        //创建复合动画,并添加
        AnimationSet animationSet = new AnimationSet(true);
        animationSet.addAnimation(rotateAnimation);
        animationSet.addAnimation(alphaAnimation);
        animationSet.addAnimation(scaleAnimation);
        //启动
        rl_welcome_root.startAnimation(animationSet);
    }
}

 

欢迎界面旋转进入

标签:xtend   find   tac   ==   apk   package   rmi   contex   edr   

原文地址:https://www.cnblogs.com/znsongshu/p/9365355.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!