Glide简单使用

GitHub地址

依赖配置

repositories {

 mavenCentral() // jcenter() works as well because it pullsfrom Maven Central

}

dependencies {

 compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.android.support:support-v4:19.1.0'

}

混淆设置


    -keep public class * implements com.bumptech.glide.module.GlideModule

    -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { **[] $VALUES; public *; }

    -keepresourcexmlelements manifest/application/meta-data@value=GlideModule

简单使用


@Override

public void onCreate(Bundle savedInstanceState) {

 ...

 ImageView imageView = (ImageView) findViewById(R.id.my_image_view);

 Glide.with(this).load("http://goo.gl/gEgYUd").into(imageView);

 }

//list里面
@Override
public View getView(int position, View recycled, ViewGroup container) {

  final ImageView myImageView;

  if (recycled == null) {

    myImageView = (ImageView)                 

    inflater.inflate(R.layout.my_image_view, container, false);

  } else {

     myImageView = (ImageView) recycled;

  }

    String url = myUrls.get(position);  

    Glide .with(myFragment)

          .load(url)

          .centerCrop()

          .placeholder(R.drawable.loading_spinner)

          .crossFade()

          .into(myImageView); 

    return myImageView;

}

你可能感兴趣的:(Glide简单使用)