Programmatically get launcher's icon size
문제
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?
해결책
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.
다른 팁
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
제휴하지 않습니다 StackOverflow