跳到主内容
Kotlin
文章阅读

Android Kotlin 加载一张网络图片

2025/12/1676 次阅读1 分钟

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"
           />
返回顶部