question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I load non-resource Drawable?

See original GitHub issue

Description

Such as GradientDrawable, ColorDrawable, It is not a URI, I use drawee.setImageDrawable but can’t work like ImageView.

Additional Information

  • Fresco version: 1.13.0
  • Platform version: Android 7.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
defHLTcommented, Apr 8, 2019

You can set a drawable as placeholder. If you think you need to, you can also set it like this:

    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithResourceId(R.drawable.ic_settings).build();

    SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
    simpleDraweeView.setImageRequest(imageRequest);
0reactions
xiandanincommented, May 20, 2019

I found a solution in ColorImageExample

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to access drawable from non activity class - Stack Overflow
Pass the context object as a parameter to the constructor of the non Activity class. Then use that context object to get the...
Read more >
Drawable resources - Android Developers
A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with...
Read more >
How To Add an Image to the Drawable Folder| Android Studio ...
Android Resources Part 1: How To Add an Image to the Drawable Folder| Android Studio Tutorial · Key moments. View all · Key...
Read more >
Can't load resource drawable Uri if drawable is a vector #2137
Loading an Uri pointing to a resource drawable "android.resource://package/drawable/ic_facebook" fails if the drawable is a Vector.
Read more >
image files in Resources drawable do not appear in Xamrin ...
If you meet error: 'Resource.Drawable' does not contain a definition for 'icon1' and you have added the image to Resources/drawable folder.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found