Android Kotlin 加载一张网络图片

2020-07-07  本文已影响0人  梁典典

flutter自学交流群1102781545,欢迎提问

build.gradle(Module:app)文件下引入插件

implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

使用

    fun loadNetImage(src : String){
        Glide.with(this).load(src).into(imageView2);
    }

xml布局

           <ImageView
              android:id="@+id/imageView2"
              android:layout_width="150dp"
              android:layout_height="150dp"
              android:layout_gravity="center"
              android:layout_marginBottom="30dp"
              android:scaleType="fitStart"
              tools:srcCompat="@tools:sample/avatars"
           />
上一篇下一篇

猜你喜欢

热点阅读