【问题标题】:Is there a way to get Image asset for app(made in android studio) from online or somewhere else [duplicate]有没有办法从在线或其他地方获取应用程序的图像资产(在 android studio 中制作)[重复]
【发布时间】:2020-09-08 22:51:31
【问题描述】:

如何获取图片资源(从在线或其他地方),以便我可以使用 android studio 在我的 android 应用中插入图片?

【问题讨论】:

标签: android


【解决方案1】:

使用图片库很简单。 (如 Glide、毕加索等)

例如。 (使用滑翔)

    String imageUrl = "https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory&fname=https://k.kakaocdn.net/dn/EShJF/btquPLT192D/SRxSvXqcWjHRTju3kHcOQK/img.png";
    Glide.with(this).load(imageUrl).into(ivImage);

它从 url 生成图像。

另外。如何使用 Glide

  1. 在 build.gradle(app) 中添加依赖

    依赖{ 实施 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' }

并使用它。

更多信息是here

【讨论】:

  • 但是我对Glide、Picasso等一无所知。还有其他方法吗?
  • @ArijitPaul,没有比使用库加载图像更简单的方法了(例如 Glide、Picasso)
【解决方案2】:

最好的方法是使用第三方图片库,如 Glide、Picasso 等。 以下是使用Glide 轻松完成此操作的方法

在 build.gradle(app) 中添加依赖

dependencies {
  implementation 'com.github.bumptech.glide:glide:4.9.0'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}

使用 Glide 获取图片

ImageView targetImageView = (ImageView) findViewById(R.id.imageView);  
String internetUrl = "http://i.imgur.com/DvpvklR.png";

Glide  
    .with(context)
    .load(internetUrl)
    .into(targetImageView);

更多内容可以参考this教程

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-24
    相关资源
    最近更新 更多