首先:
在服務端中放入圖片資源:(我使用的是springboot,如果使用springmybatis就在webapp目錄下創建)

第二步:
在你的資料庫中存入圖片名稱:

第三步:
在Android中實作圖片的加載:只需要一行代碼就可以實作!!
Glide.with(context).load(imgUri).into(iv_user);
context表示背景關系
imgUri是你的圖片地址:"http://10.0.2.2:埠號/資料庫中存盤的圖片名稱
iv_user是你布局中的控制元件名稱
Glide真的太太太好用了,其他方法都需要好幾行代碼,它一行就實作了!!!(此處是廢話,可以不看
注意:如果你的android之前沒有使用到Glide,要先在build.gradle中加入依賴:
implementation group: 'com.github.bumptech.glide', name: 'glide', version: '4.8.0'
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/287402.html
標籤:其他
上一篇:移動兼容問題
