android - Setting drawable folder to use for different resolutions -


i have 4 different sizes each of icons need use in app. problem nexus 7 (1280 x 800) , galaxy s2 (800 x 480) seem use resources in drawable-hdpi. how force nexus use resources in drawable-xhdpi , 10 inch tab use drawable-xxhdpi.

i have in manifest file

<supports-screens android:resizeable="true"               android:smallscreens="true"               android:normalscreens="true"               android:largescreens="true"               android:xlargescreens="true"               android:anydensity="true" /> 

how force nexus use resources in drawable-xhdpi , 10 inch tab use drawable-xxhdpi?

you can't.

the qualifiers hdpi,xhdpi,xxhdpi describes screen density of device, not size of screen. official doc

screen density

the quantity of pixels within physical area of screen; referred dpi (dots per inch). example, "low" density screen has fewer pixels within given physical area, compared "normal" or "high" density screen. simplicity, android groups actual screen densities 4 generalized densities: low, medium, high, , high.

if want support tablets also, use large, xlarge qualifiers. nexus 7 large-hdpi tablet(technically it's tvdpi, takes images hdpi). if want put images nexus 7, make folder named drawable-large-hdpi , put images there.

note: special case nexus 7. because though nexus 7 7 inch tablet, has resolution of 1280 * 800. it's hdpi device. normal 7 inch devices have lower resolutions of 1024 * 600. mdpi devices. drawable qualifier can change. (from own experience, first put folder drawable-large-mdpi 7 inch devices , check on nexus 7. if there no problem images, dont have put folder. because if particular folder not present, android check nearest possible folder , optimize device screen)

now regarding 10 inch tablets case, xlarge devices , densities can change mdpi xhdpi(nexus 10). many have resolution of 1280 * 800 , mdpi devices.

the better practice put following drawables

// phones drawable-ldpi drawable-mdpi drawable-hdpi  //for 7 inch tablets drawable-large-mdpi drawable-large-hdpi(for nexus 7)  // 10 inch tablets drawable-xlarge-mdpi 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -