android 启动画面实现Frame动画

效果图如下:











以下是logo.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	android:background="@drawable/logo_bg">
	<LinearLayout
		android:layout_height="wrap_content"
		android:gravity="center"
		android:layout_alignParentBottom="true"
		android:layout_width="fill_parent">
	</LinearLayout>
	<ImageView
		android:scaleType="fitCenter"
		android:layout_height="wrap_content"
		android:layout_width="wrap_content"
		android:id="@+id/progress"
		android:layout_below="@+id/textView2"
		android:layout_centerHorizontal="true"></ImageView>
	<TextView
		android:id="@+id/textView2"
		android:layout_height="wrap_content"
		android:textSize="22dp"
		android:text="Loading..."
		android:textColor="#ffffff"
		android:layout_width="wrap_content"
		android:layout_centerVertical="true"
		android:layout_centerHorizontal="true"></TextView>
</RelativeLayout>




<?xml version="1.0" encoding="UTF-8"?>
<animation-list android:oneshot="false"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:duration="150" android:drawable="@drawable/loading00" />
    <item android:duration="150" android:drawable="@drawable/loading01" />
    <item android:duration="150" android:drawable="@drawable/loading02" />
    <item android:duration="150" android:drawable="@drawable/loading03" />
    <item android:duration="150" android:drawable="@drawable/loading04" />
    <item android:duration="150" android:drawable="@drawable/loading05" />
    <item android:duration="150" android:drawable="@drawable/loading06" />
    <item android:duration="150" android:drawable="@drawable/loading07" />
    <item android:duration="150" android:drawable="@drawable/loading08" />
    <item android:duration="150" android:drawable="@drawable/loading09" />
    <item android:duration="150" android:drawable="@drawable/loading10" />
    <item android:duration="150" android:drawable="@drawable/loading11" />
</animation-list>




实现动画的效果代码:

	
	void init() {
		progress = (ImageView) findViewById(R.id.progress);
		animDrawable = (AnimationDrawable) getResources().getDrawable(R.anim.loading_gif);
		aas = new AlphaAnimation(1.0f, 1.0f);
		aas.setDuration(4000);
		progress.setAnimation(aas);

	}

	private class AnimAlpha implements AnimationListener {
		@Override
		public void onAnimationStart(Animation animation) {
			progress.setBackgroundResource(R.anim.loading_gif);
			Object background = progress.getBackground();
			animDrawable = (AnimationDrawable) background;
			animDrawable.start();

		}

		@Override
		public void onAnimationRepeat(Animation animation) {
		}

		@Override
		public void onAnimationEnd(Animation animation) {
			Intent it = new Intent(Logo.this, MainActivity.class);
			startActivity(it);
			animDrawable.stop();
			Logo.this.finish();
		}
	}



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值