fresco加载drawable图片和asstes图片

  1. /**
  2. * 加载本地图片(drawable图片)
  3. 【fresco加载drawable图片和asstes图片】* @param context
  4. * @param simpleDraweeView
  5. * @param id
  6. */
  7. public static void loadResPic(Context context, SimpleDraweeView simpleDraweeView, int id) {
  8. Uri uri = Uri.parse("res://" +
  9. context.getPackageName() +
  10. "/" + id);
  11. simpleDraweeView.setImageURI(uri);
  12. }
  13. /**
  14. * 加载本地图片(assets图片)
  15. * @param context
  16. * @param simpleDraweeView
  17. * @param nameWithSuffix 带后缀的名称
  18. */
  19. public static void loadAssetsPic(Context context, SimpleDraweeView simpleDraweeView, String nameWithSuffix) {
  20. Uri uri = Uri.parse("asset:///" +
  21. nameWithSuffix);
  22. simpleDraweeView.setImageURI(uri);
  23. }

    推荐阅读