getting the screen density programmatically in android?

后端 未结 19 2668
感动是毒
感动是毒 2020-11-22 01:56

How to get the screen density programmatically in android?

I mean: How to find the screen dpi of the current device?

相关标签:
19条回答
  • 2020-11-22 02:44

    I am using following code to access DPI from modules (no need for having access to a context object):

    (Resources.getSystem().getDisplayMetrics().xdpi
    Resources.getSystem().getDisplayMetrics().ydpi)/2
    
    0 讨论(0)
提交回复
热议问题