简体   繁体   中英

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.

在此输入图像描述

Anyway, here is the Android Asset Studio tool which would help you to generate Action bar icons.

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

I am not sure why you would want to use large images in an Action Bar

The prescribed sizes for Action Bar icons (API Level 11 and above) are these:

ldpi(120dpi) - 18x18 px

mdpi(160dpi) - 24x24 px

hdpi(240dpi) - 36x36 px

xhdpi(320dpi) - 48x48 px

Visit this link for more info: 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. 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. This one is quite the time saver.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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