Question

Can I use DrawBitmap with display independant pixels on android?

If not, is there a suitable alternative?

Thanks.

Was it helpful?

Solution

Are you looking for how to change pixels to dip? then you can use the following code

int pixel = 120;
final float scale = getResources().getDisplayMetrics().density;
int dip = (int) (pixel* scale + 0.5f);

you can use this dip, it will be

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top