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
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…