我在我的啓動畫面中加載了兩個圖像。第一個圖像打開(啓動閃屏),然後打開第二個圖像。一旦第二個圖像淡出MainActivity開始。現在我的問題是如何讓我的第一張圖像淡出,然後淡入第二張圖像?如何淡出和在兩個圖像之間?
我不想在兩者之間交叉淡入淡出。我試圖做一個完整的淡出,然後淡出過渡。
的splash.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:id="@+id/lin_lay"
android:gravity="center" >
<ImageView
android:contentDescription="@string/desc"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spinning_wheel_image"
android:background="@drawable/splashscreen1" />
</LinearLayout>
的mainanim.xml
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/splashscreen1" android:duration="2500" />
<item android:drawable="@drawable/splashscreen2" android:duration="4000" />
</animation-list>
的Splash.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
ourSong = MediaPlayer.create(Splash.this, R.raw.splashsound);
ourSong.start();
Thread timer = new Thread(){
public void run(){
try{
sleep(10500);
} catch (InterruptedException e){
e.printStackTrace();
}finally{
Intent openStartingPoint = new Intent("com.theapplication.app.STARTINGPOINT");
startActivity(openStartingPoint);
}
}
};
timer.start();
}
@Override
public void setRequestedOrientation(int requestedOrientation) {
super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
ImageView mainimage = (ImageView)findViewById(R.id.spinning_wheel_image);
mainimage.setBackgroundResource(R.anim.mainamin);
mainanimation = (AnimationDrawable) mainimage.getBackground();
mainanimation.start();
}
這裏有什麼問題嗎?你能否提供日誌貓。 – Harshid 2013-03-12 04:31:00
嘿Harshid謝謝你的評論。我的問題是我試圖讓我的啓動畫面中的兩個圖像淡出和進入。因爲現在我的啓動畫面顯示一個圖像,(不褪色),然後是另一個。我想顯示一個淡入淡出的過渡。 – Warren0618 2013-03-12 05:41:39
Plz幫助Harshid! – Warren0618 2013-03-12 05:42:04