Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out which drawable resource is used?

I want to know which drawable resource is used while running the application that is either from ldpi, mdpi, hdpi or xhdpi.

like image 775
VaaS Avatar asked Feb 13 '12 07:02

VaaS


1 Answers

You should be able to get your device's display properties as described here and subsequently determine what resources are being used at runtime by comparing the result against this list:

  • ldpi: Low-density screens; approximately 120dpi.
  • mdpi: Medium-densit (on traditional HVGA) screens; approximately 160dpi.
  • hdpi: High-density screens; approximately 240dpi.
  • xhdpi: Extra high-density screens; approximately 320dpi. Added in API Level 8
  • nodpi: This can be used for bitmap resources that you do not want to be scaled to match the device density.
  • tvdpi: Screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. This qualifier was introduced with API level 13.

From this information you can deduce the following, which might also be relevant for your question:

There is a 3:4:6:8 scaling ratio between the four primary densities (ignoring the tvdpi density). So, a 9x9 bitmap in ldpi is 12x12 in mdpi, 18x18 in hdpi and 24x24 in xhdpi.

like image 178
MH. Avatar answered Sep 24 '22 08:09

MH.