I find the methods getDimension and getDimensionPixelSize confusing.
It would look to me as though getDimension would return the actual value stored in the dimension, for example 10dp and getDimensionPixelSize would return it converted to px.
But both seem to do the same thing...
getDimension()
returns a floating point number which is the dimen value adjusted with current display metrics:
getDimensionPixelSize()
returns an integer. It is the same as getDimension()
rounded to an int
with any non-zero dimension ensured to be at least one pixel in size.
For integer dimension values they both return the same numeric value.
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