Android 用网络图片做帧动画

package com.zerofield.netanimation;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;

import java.util.ArrayList;
import java.util.HashMap;

public class MainActivity extends AppCompatActivity {

    private ImageView iv_image;
    ArrayList strArray=new ArrayList<>();
    //HashMap> mhashMap=new HashMap<>();
    ArrayList mArrayList=new ArrayList();
      HashMap mhashmap=new HashMap<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        iv_image=findViewById(R.id.iv_image);
        netAnima();
        strArray.add("http://qiniuupload.i-vsun.com/5478cc2cf148276d8abf1d3660232dc1.jpg");
        strArray.add("http://qiniuupload.i-vsun.com/2948ca06f97ec48907c5a71dff34fced.jpg");
        for (int i=0;i simpleTarget = new SimpleTarget() {
            @Override
            public void onResourceReady(GlideDrawable resource, GlideAnimation glideAnimation) {
                 mhashmap.put(pos,resource);
                 if(mhashmap.size()==strArray.size()){
                     for (int i=0;i

你可能感兴趣的:(Android,Android,帧动画)