iT邦幫忙

1

(kotlin)要怎麼建立一個List把圖片放進去?

https://ithelp.ithome.com.tw/upload/images/20210529/20137914XOmBCucPtp.png

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

2
listennn08
iT邦高手 5 級 ‧ 2021-05-29 16:02:13
最佳解答

簡單來說應該是這樣

val imageList: List<Int> = listOf(
    R.drawable.image1, // 替換成你的 image name
    R.drawable.image2,
    // ...
)

可以看看這堂課,應該能幫助你
https://developer.android.com/courses/pathways/android-basics-kotlin-unit-2-pathway-3

xhh0552 iT邦新手 5 級 ‧ 2021-05-29 16:32:57 檢舉

可以了 謝謝!
我想在請問一下 這邊該填入什麼?
https://ithelp.ithome.com.tw/upload/images/20210529/20137914gWSAepJD8p.png

imageView.setImageResource(imageList[index3])

我要發表回答

立即登入回答