Я пишу заставку в Android 2.1. Я хочу, чтобы 20 изображений png отображались в заказе на заставке. Я попытался использовать список анимации, но не смог этого сделать.Кадр за кадром анимация в заставке - Android 2.1
Вот мой код. Теперь есть изображение с именем firstLoadingImage.png. Только это показано на 5000 мс. Затем начинается 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>