Android上不同分辨率的不同图标大小 [英] Different icons size for different resolutions on Android

查看:75
本文介绍了Android上不同分辨率的不同图标大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Samgsung Galaxy Tab(1024x600px)开发一个应用程序.在活动"中,我使用一些128x128px的图标,看起来很棒.

但是我在三星Galaxy S(480x800)中运行它,并且图标太大.

我在drawable-mdpi中将相同的图标设置为100x100px,但现在它调整了两个设备的尺寸.我想这是因为Tab和Galaxy S处于相同的密度范围内.

如何根据屏幕尺寸"自动使用不同的图标?我看到layout-large,layout-xlarge是根据屏幕尺寸确定的,但是是用于布局而不是图标的.

非常感谢!

解决方案

好吧,现在有了更好的工具,然后在android studio中声明生成器

对于应用程序图标(工具栏,ActionBar,DrawableLeft等)使用:

然后单击图标"以生成图标(.png).好吧,诀窍是尝试为高分辨率设备生成尽可能大的图标,并且该工具将为小型设备处理所有图标,但是如果您使用小图标,则在为高端设备生成图标时,您将失去图标分辨率.>

第2步:

然后转到工具"页面并上传图标

如果要为图标着色,请单击自定义".无论您要上载哪种颜色的图标,都可以使用自定义"生成所需的任何颜色.然后选择一个名称,然后单击下载.ZIP".这将下载带有大多数常用分辨率图标的.zip文件.您可以将res文件夹复制并粘贴到应用程序项目文件夹中,您将在可绘制部分看到该图标.

I'm developing an application for a Samgsung Galaxy Tab (1024x600px). In a Activity I use few icons of 128x128px and looks great.

But I run it in a Samgsung Galaxy S (480x800) and icons are too large.

I put same icons at 100x100px in drawable-mdpi, but now It resized both devices. I suppose this is because Tab and Galaxy S are in the same range of density.

How can I do automatically use different icons according to SCREEN SIZE? I see layout-large, layout-xlarge is according to screen size, but is for layouts, not icons.

Thanks a lot!

解决方案

Well Now there is exists Better tools then assert generator in android studio

For application Icon ( Toolbar , ActionBar , DrawableLeft etc ) Use : http://romannurik.github.io/AndroidAssetStudio/icons-actionbar.html

For launcher (Application Icon ) Use : https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

But Here are some tricks and way to get the better resolution for icons and launcher icons.

Step 1 :

First go to the

Then click the "Icon" to generate icon (.png) . Well the trick is try to generate as large icon as possible for high resolution devices and the tools will handle it all for small devices but if you use small icon , while generating the icon for high end devices you will loose the icon resolution .

Step 2 :

Then go the Tools page and Upload the Icon

Click the "Custom" if you want to color your icon . No matter what color of icon you are uploading , by using Custom you can generate any color you want . Then choose a name and click "Download .ZIP" . This will download the .zip file with the icon for most of the common resolution . You can copy and paste the res folder in your application project folder and you will see the icon in the drawable section .

这篇关于Android上不同分辨率的不同图标大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆