How to check an Android device is HDPI screen or MDPI screen?

前端 未结 7 2155
你的背包
你的背包 2020-11-27 09:27

I want to check this to fetch different images by internet. How to do that?

相关标签:
7条回答
  • 2020-11-27 10:19
    density = getResources().getDisplayMetrics().density;
    
    // return 0.75 if it's LDPI
    // return 1.0 if it's MDPI
    // return 1.5 if it's HDPI
    // return 2.0 if it's XHDPI
    // return 3.0 if it's XXHDPI
    // return 4.0 if it's XXXHDPI
    
    0 讨论(0)
提交回复
热议问题