android - Is there any way to tell what folder a drawable resource was inflated from? -
Do anybody know which folders will be resolved by the Android system when I click on the resource ("code> drawable-length < / Code> vs.
Droplet-noelg
, for example)? I want to make sure that it is loading resources as I expect it (for example, to ensure that To do that the tattoo is not actually ldpi
and not mdpi
) because it is on the boundary line Even after receiving it from the resources, I could always print the draw size of the qualified, and I could have examined against different image sizes, but it was a pain Apart from this, my company allows its customers to have their skin before the release of their app, so after it becomes dark, I will not be able to rely on that method.
I tried! Code> resources.getName (ResId)) but it does not give the name of the folder, and as far as I know that you can get a AssetFileDescriptor
for the resource, but you can not find the actual file name.
Update: After asking this question, I have found that you can use the configuration
and DisplayMetrics
Can access getResources ()
). DisplayMetrics
can assign you the designation ldpi
/ mdpi
/ hdpi
, and the configuration
You can type short
/ normal
/ large
screen size, long
/ notlong
aspects Provide ratio, locale, mobile network code and other hardware information. However, it still does not positively confirm that you have resources that you have a complex resource set. It does not protect you from bugs which report incorrect values, such as the Motorola Droid bug where DisplayMetrics
incorrect xdpi
and ydpi
report (It reports 96dpi where the actual value is more like 265dpi! Awesome bug.)
Use a different approach to two different images, one with the same name, one in the other Resource folder blue in red. When it is blown, you will be able to see who is coming from.
If you really want to get mad, say "ldpi" or "xhdpi" for each folder and so on. When you start your project, you can note which device wanted to test clear for each device.
From the same idea, but with the strands the value directory in which the name of the bucket - making the images is less effort!