获取Android上的正确Laucher图标大小 [英] Get correct Laucher icon size on Android
问题描述
我工作的一个应用程序,它能够快捷方式图标添加到主屏幕。
什么是Android平板电脑正确的图标的大小? (或者还好说,如何在运行时得到它?)看来,从什么是对的这个页面。
我已经打开DisplayMetrics.densityDpi并相应地更改图标的大小。但它并不适用于所有devices..Gnex工作似乎是确定的,但同时beeing DisplayMetrics.DENSITY_MEDIUM
设备只显示图标48x48px我的Galaxy Tab(因为它是指南)但通常的启动图标是72x72不等#像素,而不是48×48 - 它指引的不同?难道它关系到的TouchWiz用户界面,并因此从单纯的Android不同?或者哪里出了问题?还高兴地注意到,所有应用本身显示正确的启动器图标(它从华电国际文件夹的图标),但在运行时它看起来是MDPI设备:/
谢谢
I am working on an app which is able to add shortcuts icons to the homescreen.
What is the correct icon size for Android tablets? (Or better said, how to get it at runtime?) It seems to differ from what is written on this page.
I have switch on DisplayMetrics.densityDpi and change the icon size accordingly. But it does not work for all devices..Gnex seems to be ok, but my Galaxy Tab while beeing DisplayMetrics.DENSITY_MEDIUM
device displays only 48x48px icon (as it is in guidelines), but usual launcher icons are 72x72 pixels and not 48x48 - it differs from guidelines? Is it possible that it is related to TouchWiz UI and thus it differs from pure Android? Or where is the problem? Also good to note, that apps itself displays correct launcher icon (it takes the icon from hdpi folder), but at runtime it looks like it is mdpi device:/
Thanks
推荐答案
Android平板电脑看起来一斗起来,寻找发射icon..That手段时, MDPI
设备实际上会看看华电国际
文件夹..
这code返回正确的大小启动图标
Android tablets looks one bucket up, when looking for launcher icon..That means mdpi
device will actually look into hdpi
folder..
This code returns correct size for launcher icons
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
int iconSize = am.getLauncherLargeIconSize();
答是基于这个G +后由尼克·布彻
这篇关于获取Android上的正确Laucher图标大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!