Our app manifest launcher icon in xml file drawable\\icon.xml:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/icon_beta"/>
The xml file gets modified at build time to point to either icon_beta or icon_prod.
<application android:icon="@drawable/icon"
Both icon_beta.png and icon_prod.png exist in all resolutions. However, we found that on xhdpi device hdpi icon is used instead of xhdpi. If we reference the icon directly without xml file
<application android:icon="@drawable/icon_beta"
then correct xhdpi icon is used.
Why using the xml drawable affects which resolution is used?
I found that, specifically for the Nexus 7, specifying a resource in drawable-tvdpi the same dimensions as drawable-hdpi (72p) fixes this issue. I don't know why :(.
The nexus 7 is not an xhdpi device, it has a PPI of 216 and is well within the hdpi 240 DPI bucket.
See this image (fig 1 from http://developer.android.com/guide/practices/screens_support.html )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.