Android动画GIF正在缓慢工作

Android动画GIF正在缓慢工作,android,animated-gif,Android,Animated Gif,我使用动画GIF显示进度,我将GIF设置为“图像视图”,并使用对话框显示进度 这是我与GIF的对话 public class SimplifyaProgressDialog extends Dialog { public SimplifyaProgressDialog(@NonNull Context context) { super(context); } @Override protected void onCreate(Bundle savedInstanceState) {

我使用动画GIF显示进度,我将GIF设置为“图像视图”,并使用对话框显示进度

这是我与GIF的对话

public class SimplifyaProgressDialog extends Dialog {
public SimplifyaProgressDialog(@NonNull Context context) {
    super(context);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Window window = this.getWindow();
    if (null != window) {
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    this.setCanceledOnTouchOutside(false);
    this.setCancelable(false);
    this.setContentView(R.layout.progress_dialog);
    ImageView progressImage = this.findViewById(R.id.progress_image);
    Glide.with(getContext()).asGif().load(R.raw.main_loader).into(progressImage);
}
}
这是一个网络呼叫,我在登录时使用

 this.showProgress();
        subscription = this.makeUIObservable(authService.authenticate(email, password))
                .subscribe(
                        msg -> {
                            this.hideProgress();
                            onSuccess(msg);
                        },
                        error -> {
                            this.hideProgress();
                            if (error instanceof ApiError) {
                                this.showAlert(error.getMessage());
                            }
                        }
                );
在这里你们可以看到我是如何显示和隐藏对话框的,所以当我在网络调用中使用这个动画GIF时,它显示动画的速度非常慢,我该如何处理这个问题呢


谢谢

考虑将硬件加速添加到缓慢渲染视图中。这可以带来真正的不同。您可以在以下级别控制硬件加速:

  • 应用
  • 活动
  • 窗口
  • 看法
添加的方式是(在活动中):


我对glide也有同样的问题,现在使用了另一个运行良好的库。编译'pl.droidsonroids.gif:android gif drawable:1.2.7'谢谢@SumitKumar我会试试的
<Activity android:hardwareAccelerated="true" >
</Activity>