I know the PaintText on Canvas in android takes its size in a scalable measurement, but strokeWidth for painting a line or something is exact pixel size… so, how do I calculate what my stroke width should be on screens with varying screen densities?
I know I could create a standard image and then just draw the image, and it would have its density taken care of by the OS, but this seems like overkill to me. Seems like there should be some simple method, and probably is, that says convert this true pixel amount relative to densixy X to the pixes size it should be for density Y… or better yet, just have the setStroke have an alternate that takes density into account. (I don’t see that, but that would be nice.)
How would I do this? Or does this exist and I am just overlooking it somewhere in the API?
Define your densities in an xml using dimension.
Then you can use getResources().getDimensionPixelSize(R.dimen.yourdensity) to get pixel value for the density and use it for strokewidth.