Using callback for CompoundDrawables
See original GitHub issueHi, I want, to use Picasso for compound drawables since It’s doing a great job for ImageViews. But it doesn’t really work. The place where the image should come just stays white.
This is what I’ve done so for. bitmap is the URL of the Image.
Picasso.with(getActivity().getApplicationContext()).load(bitmap).into(new Target() {
public void onBitmapLoaded(Bitmap bitmapPic, LoadedFrom from){
Drawable d = new BitmapDrawable(getResources(), bitmapPic);
textView[picassoCounter].setCompoundDrawablesWithIntrinsicBounds(d, null, null, null);
textView[picassoCounter].setCompoundDrawablePadding(5);
}
public void onBitmapFailed(Drawable errorDrawable){
Drawable d = getResources().getDrawable(R.drawable.nofavicon);
textView.setCompoundDrawablesWithIntrinsicBounds(d, null, null, null);
textView.setCompoundDrawablePadding(5);
}
public void onPrepareLoad(Drawable placeHolderDrawable){
}
});
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Compound Drawables - Styling Android
In this article we'll have a look at what they are and see how we can use them to simplify some of our...
Read more >Drawable | Android Developers
Levels: a compound drawable that selects one of a set of drawables based on its level. Scale: a compound drawable with a single...
Read more >Button stays in pressed state after OnTouch callback
I'm defining a CompoundDrawable on a button and reacting for clicks on it: mFileSelector.setOnTouchListener(new View.
Read more >graphics/java/android/graphics/drawable/Drawable.java - platform ...
interface (via {@link #setCallback}) so that animations will work. A ... <li> <b>Scale</b>: a compound drawable with a single child drawable,.
Read more >Setting the Color of a TextView Drawable for Android
Hey, if you didn't already know, I'm currently working on an open world stealth exploration game called Farewell North in my spare time, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Subclass
TextViewand implementTargeton that class. Have theonBitmapSuccesscallback set the compound drawable. Use the subclass in your XML or code instead ofTextView.http://stackoverflow.com/a/36310327/5028508