Question

I'm trying to programmatically get the launcher's icon size. It differs between devices. I don't have the assets in advance, I'm creating them.

Can I somehow query for the right icon dimensions for the specific launcher?

Was it helpful?

Solution

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
switch(metrics.densityDpi){
     case DisplayMetrics.DENSITY_LOW:
                break;
     case DisplayMetrics.DENSITY_MEDIUM:
                 break;
     case DisplayMetrics.DENSITY_HIGH:
                 break;
}

After getting the density... you will know which launcher icon is used and their Dimensions.

OTHER TIPS

http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html

ldpi (120 dpi) 36 x 36 px
mdpi (160 dpi) 48 x 48 px
hdpi (240 dpi) 72 x 72 px
xhdpi (320 dpi) 96 x 96 px

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top