fresco載入drawable圖片和asstes圖片
阿新 • • 發佈:2019-01-30
.
/** * 載入本地圖片(drawable圖片) * @param context * @param simpleDraweeView * @param id */ public static void loadResPic(Context context, SimpleDraweeView simpleDraweeView, int id) { Uri uri = Uri.parse("res://" + context.getPackageName() + "/" + id); simpleDraweeView.setImageURI(uri); } /** * 載入本地圖片(assets圖片) * @param context * @param simpleDraweeView * @param nameWithSuffix 帶字尾的名稱 */ public static void loadAssetsPic(Context context, SimpleDraweeView simpleDraweeView, String nameWithSuffix) { Uri uri = Uri.parse("asset:///" + nameWithSuffix); simpleDraweeView.setImageURI(uri); }