How would I use picasso to crop an image to an ImageView?
Default seems to scale it down so the whole thing shows fit seems to stretch it. Centercrop by itself breaks. fit centercrop seems to be the same as just fit
Try using centerCrop()
Picasso.with(mContext)
.load(url)
.centerCrop()
.resize(yourImageView.getMeasuredWidth(),yourImageView.getMeasuredHeight())
.error(R.drawable.error)
.placeholder(R.drawable.blank_img)
.into(yourImageView);
You have to add addOnPreDrawListener
listener otherwise you will get 0 for width and height when the imageview is not drawn. Go here for details on how to use addOnPreDrawListener
.