Glide 4.7.1 placeholder not loading
I am trying to load a placeholder image using GlideLibrary and I am using SimpleTarget. The placeholder image is not loading but the image from the url is loading. I have searched a lot and used RequestOptions as well. Still, it doesn't seem to work.
Below is the code :
Glide.with(mContext).load("https://i.imgur.com/0k7ZFWr.png").apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon)).into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
I am using Glide library 4.7.1. I have tried using setDefaultRequestOptions() as well - not working.
My cardview XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/category_cardview"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="#FFBF41"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/cardImageLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="60dp"
android:orientation="vertical">
<TextView
android:id="@+id/category_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="bottom"
android:paddingLeft="5dp"
android:shadowColor="#f3848383"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="2"
android:text="WEAPONS"
android:textColor="@color/colorWhite"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3"
android:background="#000"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/category_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="11dp"
android:text="Know your weapons before you shoot"
android:textColor="@color/colorLightWhite"
android:textScaleX="1" />
</LinearLayout>
<com.romainpiel.shimmer.ShimmerTextView
android:id="@+id/arrow_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="0.2"
android:gravity="right"
android:text=">>>>>"
android:textColor="#000"
android:textScaleX="1.5"
android:textStyle="bold"
app:reflectionColor="#FFBF41" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
add a comment |
I am trying to load a placeholder image using GlideLibrary and I am using SimpleTarget. The placeholder image is not loading but the image from the url is loading. I have searched a lot and used RequestOptions as well. Still, it doesn't seem to work.
Below is the code :
Glide.with(mContext).load("https://i.imgur.com/0k7ZFWr.png").apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon)).into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
I am using Glide library 4.7.1. I have tried using setDefaultRequestOptions() as well - not working.
My cardview XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/category_cardview"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="#FFBF41"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/cardImageLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="60dp"
android:orientation="vertical">
<TextView
android:id="@+id/category_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="bottom"
android:paddingLeft="5dp"
android:shadowColor="#f3848383"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="2"
android:text="WEAPONS"
android:textColor="@color/colorWhite"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3"
android:background="#000"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/category_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="11dp"
android:text="Know your weapons before you shoot"
android:textColor="@color/colorLightWhite"
android:textScaleX="1" />
</LinearLayout>
<com.romainpiel.shimmer.ShimmerTextView
android:id="@+id/arrow_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="0.2"
android:gravity="right"
android:text=">>>>>"
android:textColor="#000"
android:textScaleX="1.5"
android:textStyle="bold"
app:reflectionColor="#FFBF41" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
what you actually trying to do.. Load placeholder until the image is not properly loaded?
– Devil10
Aug 17 '18 at 8:53
add a comment |
I am trying to load a placeholder image using GlideLibrary and I am using SimpleTarget. The placeholder image is not loading but the image from the url is loading. I have searched a lot and used RequestOptions as well. Still, it doesn't seem to work.
Below is the code :
Glide.with(mContext).load("https://i.imgur.com/0k7ZFWr.png").apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon)).into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
I am using Glide library 4.7.1. I have tried using setDefaultRequestOptions() as well - not working.
My cardview XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/category_cardview"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="#FFBF41"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/cardImageLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="60dp"
android:orientation="vertical">
<TextView
android:id="@+id/category_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="bottom"
android:paddingLeft="5dp"
android:shadowColor="#f3848383"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="2"
android:text="WEAPONS"
android:textColor="@color/colorWhite"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3"
android:background="#000"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/category_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="11dp"
android:text="Know your weapons before you shoot"
android:textColor="@color/colorLightWhite"
android:textScaleX="1" />
</LinearLayout>
<com.romainpiel.shimmer.ShimmerTextView
android:id="@+id/arrow_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="0.2"
android:gravity="right"
android:text=">>>>>"
android:textColor="#000"
android:textScaleX="1.5"
android:textStyle="bold"
app:reflectionColor="#FFBF41" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
I am trying to load a placeholder image using GlideLibrary and I am using SimpleTarget. The placeholder image is not loading but the image from the url is loading. I have searched a lot and used RequestOptions as well. Still, it doesn't seem to work.
Below is the code :
Glide.with(mContext).load("https://i.imgur.com/0k7ZFWr.png").apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon)).into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
I am using Glide library 4.7.1. I have tried using setDefaultRequestOptions() as well - not working.
My cardview XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/category_cardview"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="4dp"
android:layout_height="match_parent"
android:background="#FFBF41"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/cardImageLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/leftrightmargin"
android:layout_marginRight="@dimen/leftrightmargin"
android:layout_marginTop="60dp"
android:orientation="vertical">
<TextView
android:id="@+id/category_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="bottom"
android:paddingLeft="5dp"
android:shadowColor="#f3848383"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="2"
android:text="WEAPONS"
android:textColor="@color/colorWhite"
android:textSize="30sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3"
android:background="#000"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/category_desc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="11dp"
android:text="Know your weapons before you shoot"
android:textColor="@color/colorLightWhite"
android:textScaleX="1" />
</LinearLayout>
<com.romainpiel.shimmer.ShimmerTextView
android:id="@+id/arrow_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="0.2"
android:gravity="right"
android:text=">>>>>"
android:textColor="#000"
android:textScaleX="1.5"
android:textStyle="bold"
app:reflectionColor="#FFBF41" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
edited Aug 17 '18 at 8:11
Charan Shetty
asked Aug 17 '18 at 8:00
Charan ShettyCharan Shetty
62
62
what you actually trying to do.. Load placeholder until the image is not properly loaded?
– Devil10
Aug 17 '18 at 8:53
add a comment |
what you actually trying to do.. Load placeholder until the image is not properly loaded?
– Devil10
Aug 17 '18 at 8:53
what you actually trying to do.. Load placeholder until the image is not properly loaded?
– Devil10
Aug 17 '18 at 8:53
what you actually trying to do.. Load placeholder until the image is not properly loaded?
– Devil10
Aug 17 '18 at 8:53
add a comment |
2 Answers
2
active
oldest
votes
placeHolderOf sets place Holder image only if you are loading it in an ImageView. If you want to set place holder to a ViewGroup, SimpleTarget class provides a method which you can override to set background when image starts loading.
In your case try loading like below :
Glide.with(mContext)
.load("https://i.imgur.com/0k7ZFWr.png")
.apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon))
.into(new SimpleTarget<Drawable>() {
@Override
public void onLoadStarted(@Nullable Drawable resource) {
holder.cardImageLayout.setBackground(resource);
}
@Override
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
add a comment |
You can like this with Glide (4.7.1)
Glide.with(getActivity()).load(avatar)
.apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.mipmap.defaultusericon))
.into(mUserIcon);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51890846%2fglide-4-7-1-placeholder-not-loading%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
placeHolderOf sets place Holder image only if you are loading it in an ImageView. If you want to set place holder to a ViewGroup, SimpleTarget class provides a method which you can override to set background when image starts loading.
In your case try loading like below :
Glide.with(mContext)
.load("https://i.imgur.com/0k7ZFWr.png")
.apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon))
.into(new SimpleTarget<Drawable>() {
@Override
public void onLoadStarted(@Nullable Drawable resource) {
holder.cardImageLayout.setBackground(resource);
}
@Override
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
add a comment |
placeHolderOf sets place Holder image only if you are loading it in an ImageView. If you want to set place holder to a ViewGroup, SimpleTarget class provides a method which you can override to set background when image starts loading.
In your case try loading like below :
Glide.with(mContext)
.load("https://i.imgur.com/0k7ZFWr.png")
.apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon))
.into(new SimpleTarget<Drawable>() {
@Override
public void onLoadStarted(@Nullable Drawable resource) {
holder.cardImageLayout.setBackground(resource);
}
@Override
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
add a comment |
placeHolderOf sets place Holder image only if you are loading it in an ImageView. If you want to set place holder to a ViewGroup, SimpleTarget class provides a method which you can override to set background when image starts loading.
In your case try loading like below :
Glide.with(mContext)
.load("https://i.imgur.com/0k7ZFWr.png")
.apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon))
.into(new SimpleTarget<Drawable>() {
@Override
public void onLoadStarted(@Nullable Drawable resource) {
holder.cardImageLayout.setBackground(resource);
}
@Override
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
placeHolderOf sets place Holder image only if you are loading it in an ImageView. If you want to set place holder to a ViewGroup, SimpleTarget class provides a method which you can override to set background when image starts loading.
In your case try loading like below :
Glide.with(mContext)
.load("https://i.imgur.com/0k7ZFWr.png")
.apply(RequestOptions.placeholderOf(R.drawable.pubgguide_icon))
.into(new SimpleTarget<Drawable>() {
@Override
public void onLoadStarted(@Nullable Drawable resource) {
holder.cardImageLayout.setBackground(resource);
}
@Override
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
holder.cardImageLayout.setBackground(resource);
Drawable cardViewBackground = holder.cardImageLayout.getBackground();
cardViewBackground.setColorFilter(0x5F000000, PorterDuff.Mode.SRC_ATOP);
}
}
});
answered Aug 17 '18 at 9:19
Akshay Bhat 'AB'Akshay Bhat 'AB'
2,52831228
2,52831228
add a comment |
add a comment |
You can like this with Glide (4.7.1)
Glide.with(getActivity()).load(avatar)
.apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.mipmap.defaultusericon))
.into(mUserIcon);
add a comment |
You can like this with Glide (4.7.1)
Glide.with(getActivity()).load(avatar)
.apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.mipmap.defaultusericon))
.into(mUserIcon);
add a comment |
You can like this with Glide (4.7.1)
Glide.with(getActivity()).load(avatar)
.apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.mipmap.defaultusericon))
.into(mUserIcon);
You can like this with Glide (4.7.1)
Glide.with(getActivity()).load(avatar)
.apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.mipmap.defaultusericon))
.into(mUserIcon);
edited Nov 13 '18 at 9:12
EstevaoLuis
1,14851729
1,14851729
answered Nov 13 '18 at 8:48
豆软亮豆软亮
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51890846%2fglide-4-7-1-placeholder-not-loading%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what you actually trying to do.. Load placeholder until the image is not properly loaded?
– Devil10
Aug 17 '18 at 8:53