私はアンドロイド2.1にスプラッシュ画面を書いています。私はスプラッシュ画面で20個の画像を注文してほしい。私はアニメーションリストを使用しようとしましたが、それを行うことができませんでした。スプラッシュ画面のフレーム別アニメーション - Android 2.1
ここに私のコードです。さて、firstLoadingImage.pngというイメージがあります。 5000msの間しか表示されません。その後、myappactivityが始まります。しかし、この待機時間中にイメージソースを更新することはできませんでした。私はこれをどうやってできると思いますか?
SplashScreenActivity
package myapp.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
public class SplashScreenActivity extends Activity {
protected boolean _active = true;
protected int _splashTime = 5000; // time to display the splash screen in ms
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
Thread splashTread = new Thread() {
@Override
public void run() {
try {
int waited = 0;
while(_active && (waited < _splashTime)) {
sleep(100);
if(_active) {
waited += 100;
}
}
} catch(InterruptedException e) {
// do nothing
} finally {
finish();
startActivity(new Intent(SplashScreenActivity.this, MyAppActivity.class));
stop();
}
}
};
splashTread.start();
}
}
splashscreen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/linearLayout"
android:background="@drawable/loading_screen_background" >
<ImageView
android:id="@+id/firstLoadingImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/loading100" />
</LinearLayout>