我在启动画面中实现了Gif(630kb,230 x 480) 不太顺利,在Mainactivity启动前一秒钟它完全冻结了。
我正在使用Glide 4.10
android:layout_width="0dp"
app:layout_constraintWidth_default="percent"
app:layout_constraintWidth_percent=".4"
我的SplashScreen.class
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
这是我的activity_splash.xml:
public class SplashScreen extends activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_splash);
ImageView imageView = (ImageView) findViewById(R.id.splashgif);
Glide.with(this)
.asGif()
.load(R.drawable.mygif)
.into(imageView);
Thread myThread = new Thread() {
@Override
public void run() {
try {
sleep(3000);
Intent intent = new Intent(getapplicationContext(),Mainactivity.class);
startactivity(intent);
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
myThread.start();
}
}
我的应用程序包含许多小图像,这些图像需要一些时间才能加载,这可能是我的启动屏幕无法流畅运行的原因吗? 我该怎么办还是必须接受它?
亲切的问候