在我的项目 Glide 库中不加载图像
in my project Glide library not load image
java 从 URL
加载图像的代码
ImageView img = (ImageView) findViewById(R.id.imageView);
Glide.with(MainActivity.this)
.load("https://yildirim.bel.tr/uploads/haberler/4509c5f0-7498-
4932-85d4-767e48408299image.jpeg")
.into(img);
清单
<uses-permission android:name="com.googleandroid.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Gradle
implementation 'com.github.bumptech.glide:glide:3.8.0'
试试这个
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.mipmap.ic_launcher_round)
.error(R.mipmap.ic_launcher_round);
Glide.with(this).load(image_url).apply(options).into(imageView);
首先像这样创建一个 class:
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
// new since Glide v4
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {
// leave empty for now
}
然后调用 Glide 为:
GlideApp.with(context)
.load("https://yildirim.bel.tr/uploads/haberler/4509c5f0-7498-
4932-85d4-767e48408299image.jpeg")
.override(300, 200)
.into(img);
java 从 URL
加载图像的代码 ImageView img = (ImageView) findViewById(R.id.imageView);
Glide.with(MainActivity.this)
.load("https://yildirim.bel.tr/uploads/haberler/4509c5f0-7498-
4932-85d4-767e48408299image.jpeg")
.into(img);
清单
<uses-permission android:name="com.googleandroid.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Gradle
implementation 'com.github.bumptech.glide:glide:3.8.0'
试试这个
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.mipmap.ic_launcher_round)
.error(R.mipmap.ic_launcher_round);
Glide.with(this).load(image_url).apply(options).into(imageView);
首先像这样创建一个 class:
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
// new since Glide v4
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {
// leave empty for now
}
然后调用 Glide 为:
GlideApp.with(context)
.load("https://yildirim.bel.tr/uploads/haberler/4509c5f0-7498-
4932-85d4-767e48408299image.jpeg")
.override(300, 200)
.into(img);