How do I convert dp into px in the android studio?

Please Share On:

According to Android Development Guide. They provide us an easy formula to convert dp into px and vice versa.

You can also use the following formula to convert dp into px

px = dp * dpi / 160

or if you want to convert px into dp, use the following formula:

dp = px / (dpi / 160)

That’s it. By using the above formula you can convert into dp to px or px to dp.



Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright @2023. All Right Reserved.


Social media & sharing icons powered by UltimatelySocial