Created
December 7, 2014 13:57
-
-
Save gouravd/169f8dcd4f6325c8480e to your computer and use it in GitHub Desktop.
FixedWidth VariableHeight Image resizing in Picasso 2.4.0
This file contains hidden or 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
yourview.getViewTreeObserver() | |
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | |
// Wait until layout to call Picasso | |
@Override | |
public void onGlobalLayout() { | |
// Ensure we call this only once | |
yourview.getViewTreeObserver() | |
.removeOnGlobalLayoutListener(this); | |
Picasso.with(mContext) | |
.load(strImage) | |
//.placeholder(R.drawable.profile_wall_picture) | |
.resize(yourview.getWidth(), 0) | |
.into(yourview); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment