简体   繁体   English

操作栏图标不适合其他Android图标

[英]Action bar Icon not fit like other android icons

我正在制作andriod应用程序,每件事情都进展顺利,但是当我使用大图像作为动作栏时,android平台不适合动作栏的大小,图标显得非常大,那么如何设置图标的宽度和高度在Android的动作栏中

I hope you have read Action Bar Icons document, because document already contains sizes of icons. 我希望您已阅读Action Bar Icons文档,因为文档已包含图标大小。

在此输入图像描述

Anyway, here is the Android Asset Studio tool which would help you to generate Action bar icons. 无论如何,这里是Android Asset Studio工具 ,它可以帮助您生成操作栏图标。

我已经通过根据android标准为每个密度制作昏暗文件来解决这个问题,并且当从服务器接收图像时使用相应的昏暗值重新调整它们的大小,然后将它们添加到我的操作栏

I am not sure why you would want to use large images in an Action Bar 我不确定你为什么要在Action Bar使用大图像

The prescribed sizes for Action Bar icons (API Level 11 and above) are these: Action Bar图标(API Level 11及以上)的规定尺寸如下:

ldpi(120dpi) - 18x18 px ldpi(120dpi) - 18x18像素

mdpi(160dpi) - 24x24 px mdpi(160dpi) - 24x24像素

hdpi(240dpi) - 36x36 px hdpi(240dpi) - 36x36像素

xhdpi(320dpi) - 48x48 px xhdpi(320dpi) - 48x48像素

Visit this link for more info: http://developer.android.com/guide/practices/ui_guidelines/icon_design_action_bar.html 有关详细信息,请访问此链接: http//developer.android.com/guide/practices/ui_guidelines/icon_design_action_bar.html

Alternatively, simply use the Android Asset Studio to create the necessary resources for you. 或者,只需使用Android Asset Studio为您创建必要的资源。 All you have to do there is select the Image you want the Action Bar icons for and it creates them for you in a ZIP file ready to use. 您只需选择您想要操作栏图标的图像,然后在准备使用的ZIP文件中为您创建它们。 This one is quite the time saver. 这个节省时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM