1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AndroidでURLから画像を表示する方法

Posted at

AndroidでURLから画像を表示する方法をメモします。

Glide、Picasso、Coilの表示方法を書くが、Glideの方が扱いやすく、安定し、性能も高いためおすすめです。

Glide を使う方法

xml
<ImageView
    android:id="@+id/image"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:scaleType="centerCrop" />
kotlin
val imageView = binding.image
val url = "https://example.com/sample.jpg"

Glide.with(this)
    .load(url)
    .into(imageView)

Picasso を使う方法

val imageView = binding.image
Picasso.get().load("https://example.com/sample.jpg").into(imageView)

Coil を使う方法

val imageView = binding.image

imageView.load("https://example.com/sample.jpg")
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?