效果演示:

项目结构:(Android4.0.3 API 15)

核心代码:
仅供参考!
activity_main.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.5"
android:background="@drawable/bg3" />
<com.ant.liao.GifView
android:id="@+id/gifview1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="150dp" >
</com.ant.liao.GifView>
</FrameLayout>
MainActivity.java
package com.polaris.flower2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import com.ant.liao.GifView;
public class MainActivity extends Activity {
private GifView mGifView1;
private ImageView img;
private Animation anim;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mGifView1 = (GifView) findViewById(R.id.gifview1);
img = (ImageView) findViewById(R.id.imageView1);
anim = AnimationUtils.loadAnimation(MainActivity.this,
R.anim.alpha_animation);
img.startAnimation(anim);
mGifView1.setGifImage(R.drawable.niyan);
new Thread() {
public void run() {
try {
Thread.sleep(4000);
startActivity(new Intent(MainActivity.this,
FlowerActivity.class));
overridePendingTransition(android.R.anim.fade_in,
android.R.anim.fade_out);
finish();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
}
};
}.start();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
finish();
super.onPause();
}
}
alpha_animation.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<alpha
android:duration="5000"
android:fromAlpha="0.1"
android:interpolator="@android:anim/accelerate_interpolator"
android:repeatCount="0"
android:toAlpha="1.0" />
</set> AndroidManifest.xml
<activity
android:name="com.polaris.flower2.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Android开发环境下载地址:
点击打开链接
欢迎微信扫码关注,非常感谢您的支持~

定制请联系:
QQ:740231248
|