首页 文章

设置Android应用程序的图标

提问于
浏览
470

如何为Android应用程序设置图标?

16 回答

  • 21

    如果您有SVG图标,则可以使用此script生成您的Android图标集 .

  • 14

    右键单击您的项目,转到 New > Other > Android > Android Icon Set

    然后按照向导上的说明进行操作

  • 12

    定义android应用程序的图标

    <application android:icon="drawable resource">
    .... 
    </application>
    

    https://developer.android.com/guide/topics/manifest/application-element.html


    如果您的应用适用于各种设备

    您应该为所有通用屏幕密度创建单独的图标,包括低,中,高和超高密度屏幕 . 这可以确保您的图标可以在可以安装应用程序的设备范围内正确显示...

    enter image description here


    尺寸和格式

    启动器图标应为32位PNG,带有透明的alpha通道 . 对应于给定的通用屏幕密度的完成的启动器图标尺寸显示在下表中 .

    enter image description here


    在mipmap或drawable文件夹中放置图标

    android:icon="@drawable/icon_name"android:icon="@mipmap/icon_name"

    developer.android.com/guide says

    必须将此属性设置为对包含图像的可绘制资源的引用(例如“@ drawable / icon”) .

    about launcher icons android-developers.googleblog.com says,

    最佳做法是将应用程序图标放在mipmap文件夹(而不是可绘制文件夹)中,因为它们的分辨率与设备的当前密度不同 . 例如,可以在启动器上为xxhdpi设备使用xxxhdpi应用程序图标 .

    Dianne Hackborn from Google (Android Framework) says

    如果要为不同的密度构建不同版本的应用程序,则应该了解“mipmap”资源目录 . 这与“可绘制”资源完全相同,只是在创建不同的apk目标时不参与密度剥离 .

    对于启动器图标,AndroidManifest.xml文件必须引用mipmap / location

    <application android:name="ApplicationTitle"
             android:label="@string/app_label"
             android:icon="@mipmap/ic_launcher" >
    

    多一点引用this

    • 您想为设备密度加载图像,并且您将使用它"as is",而不更改其实际大小 . 在这种情况下,您应该使用 drawables ,Android将为您提供最佳的图像 .

    • 您想为设备密度加载图像,但此图像将按比例放大或缩小 . 例如,当您想要显示更大的启动器图标,或者您有动画时,需要这样做,这会增加图像的大小 . 在这种情况下,为了确保最佳图像质量,您应该将图像放入 mipmap 文件夹中 . Android会做的是,它会尝试从更高密度的存储桶中获取图像,而不是将其放大 . 这将增加图像的清晰度(质量) .

    更多你可以阅读mipmap vs drawable folders


    轻松生成资产的工具

    阅读更多:https://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html

  • 1

    你可以简单地安装Android工作室Martial图标插件,它的名字是请检查插件URL Material Design Icon Generator并查看此GIF以获取更多详细信息:

    Android studio icons plugin

    这主要用于创建具有所需大小的图标,并且它将直接位于其文件夹中 .

  • 3

    有点旧,但供将来使用:

    Open Android Studio -> app/src/main/res -> Right Click -> Image Asset
    
  • 28
    • 选择图标图片复制此图片

    • 将其粘贴到项目的 res/drawable 文件夹中

    • 打开清单文件并设置

    • 运行程序

  • 6

    如果您打算在多种设备上使用您的应用程序,则应将应用程序图标放入提供的不同 res/drawable... 文件夹中 . 在每个文件夹中,您应该包含一个48dp大小的图标:

    • drawable-ldpi (120 dpi,低密度屏幕) - 36px x 36px

    • drawable-mdpi (160 dpi,中密度屏幕) - 48px x 48px

    • drawable-hdpi (240 dpi,高密度屏幕) - 72px x 72px

    • drawable-xhdpi (320 dpi,超高密度屏幕) - 96px x 96px

    • drawable-xxhdpi (480 dpi,超高密度屏幕) - 144px x 144px

    • drawable-xxxhdpi (640 dpi,额外超高密度屏幕) - 192px x 192px

    然后,您可以在 AndroidManifest.xml 文件中定义图标:

    <application android:icon="@drawable/icon_name" android:label="@string/app_name" >
    .... 
    </application>
    
  • 5

    我发现this tool最有用 .

    • 上传图片 .

    • 下载一个拉链 .

    • 提取到您的项目中 .

    Done

    http://romannurik.github.io/AndroidAssetStudio/

  • 175

    这很简单 .

    现在只需转到菜单文件→新建→图像资产 . 这将打开一个新的对话框,然后确保选中了启动器图标(默认情况下是这样),然后浏览到您的图标目录(它不必在项目资源中),然后一旦选中,请确保其他设置是你喜欢和完成的 .

    现在所有分辨率都保存在各自的文件夹中,您不必担心自己复制或使用工具等 .

    Enter image description here

    不要忘记透明背景的“形状 - 无” .

  • 37

    使用自动添加应用程序启动器图标浆纱 .

    (Android studio)

    转到菜单文件*→新建→图像资源→选择启动器图标→选择图像文件 .

    它会自动重新调整大小 .

    完成!

  • 138

    1-Create Your icon in Photoshop Or Coreldraw by size 256*256

    请注意,如果您想拥有透明图标,请使用PNG文件格式

    2-Upload Your icon in https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

    3-Set your setting on this site
    enter image description here

    4-Download the zip file automatically created by the webpage by clicking on download button
    enter image description here

    5-Extract the zip file and copy res folder to you project library
    enter image description here

    请注意,res文件夹包含所有大小的图标

    6-finally you need to set the manifest to use icon

    <application android:icon="@drawable/your_icon" >
    .... 
    </application>
    
  • 36

    将图像放在三个中的任何一个下的drawables文件夹中,并将其设置为这样 .

    Code

    <application android:icon="@drawable/your_icon" >
    .... 
    </application>
    
  • 5

    您必须遵循以下步骤:

    • 你会看到你的默认图标 ic_launcher.png

    enter image description here

    • 您必须更改 mipmap-xxxx 文件夹中的所有图像 . 首先,您必须创建自己的徽标或选择要作为启动器图标放置的图像并在此处上传Android Asset Studio - Icon Generator - Launcher图标,您将从该链接获得所有mipmap-xxxx和web_icon的集合 .

    enter image description here

    • 现在你必须复制res文件夹一侧的所有文件夹,

    enter image description here

    • 现在转到Android Studio Project -> Right click on res folder -> Paste . 它会提示你文件 'ic_launcher.png' 已经存在于目录中,你可以按下全部覆盖 . 它将粘贴/替换相应文件夹中的图像 .

    现在,您可以使用新图像运行并查看应用程序图标 .

    快乐编码:) :)

  • 0

    转到文件 - > new-> ImageAsset .

    从他们可以为您的图标创建图像资产 .

    之后我们将获得mipmap中的图标图像,如hdpi,mdpi,xhdpi,xxhdpi,xxxhdpi .

    现在转到AndroidManifest.xml

    <application android:icon="@mipmap/your_Icon"> ....</application>
    
  • 626

    将您的图像放在 mipmap 文件夹中并在清单文件中设置...如同

    <application android:icon="@mipmap/icon" android:label="@string/app_name" >
     .... 
     </application>
    

    App Folder Directory :

    enter image description here

    Icon Size & Format :
    enter image description here

  • 6

    您可以从阅读文档开始 .

    这是一个链接:

    How to change the launcher logo of an app in Android Studio?

相关问题