I am quite confused about resizing with Picasso. If I understand it correctly, we have to pass pixels to the resize
method, so we manually have to convert them from dp to support different screen densities.
But what does the resizeDimen
method do? Does it take dimension in dp so we don't have to convert them manually anymore?
How is that related to the fit
method?
resizeDimen
use dimen resource (not dp nether px). Dimen resources looks like <dimen name="logo_width">96dp</dimen>
and they are used like this : R.dimen.logo_width
.resize
method use pixel
fit
method will resize your source according to the target size (usually an ImageView)Note : The conversion from any dimension units to pixels is made by an Android context (the context in Picasso.with(context)
). Take a look at this method from Picasso source code and this method from Android source code to understand how conversion works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With