Last active
July 28, 2016 11:49
-
-
Save fangzhzh/12945fc426317b6a14c2 to your computer and use it in GitHub Desktop.
android, java, draw two bitmaps with Picasso.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Picasso.with(getContext()) | |
.load(CONST.IMAGE_SERVER + cover.image_url) | |
.into(new Target() { | |
@Override | |
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) { | |
Bitmap bmOverlay = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig()); | |
Bitmap play= BBAppResource.bitmap(R.drawable.btn_me_account); | |
Canvas canvas = new Canvas(bmOverlay); | |
canvas.drawBitmap(bitmap, new Matrix(), null); | |
float left = (float)((bitmap.getWidth()-play.getWidth())/2.0); | |
float top = (float)((bitmap.getHeight()-play.getHeight())/2.0); | |
canvas.drawBitmap(BBAppResource.bitmap(R.drawable.btn_me_account), left, top, null); | |
setImageDrawable( new BitmapDrawable(getResources(),bmOverlay)); | |
} | |
@Override | |
public void onBitmapFailed(Drawable drawable) { | |
} | |
@Override | |
public void onPrepareLoad(Drawable drawable) { | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment