Domanda

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?

È stato utile?

Soluzione

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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top