Android icon generator for actionbar and notification not working (grey shape)

心不动则不痛 提交于 2019-12-18 10:43:26

问题


I found this Asset Studio to generate icons. It works fine for the launcher icon but for action bar or notification icons it is not working. I put in my png file and want to generate the icons, but Asset Studio is only generating gray circles. Is there another tool to generate action bar and notification icons?


回答1:


You can use a tool for creating generic icons in Asset Studio: https://romannurik.github.io/AndroidAssetStudio/icons-generic.html. To get it look like ActionBar Icon, you should make next actions:

  1. Choose image
  2. The size of image should stay at 24dip
  3. Change padding to 4dip
  4. Move foreground color thumb to 0%
  5. That's it! Download .zip now.

The sizes of icons will be pretty the same as you can get them with ActionBar Icon Generator.

How it looks for me:




回答2:


I think it's because your image is too complexe and the main problem is the "color" filter applied in AAS.

I had the same problem and I had to convert xxxhdpi xxhdpi etc. manually. If you work with Sketch (for example) it can be converted easily with a plugin (https://github.com/zmalltalker/sketch-android-assets)

hope it's help !

If you want to use AAR, like @rom4ek explained "4. Move foreground color thumb to 0%" this is the important part




回答3:


I use an own module 'icons' with a Gradle script to generate icons. This is a more automated way than the Assets Studio can provide up-to-now. The icon will be designed with Inkscape. See my blog for a detailed description. You find an Android Studio Project on GitHub.




回答4:


after alot of search this is the solution: the problem is you are adding an image with white background.. to convert the image to actionbar icon you have to load image with transparent background




回答5:


You can use the built in feature of android studio to generate actionbar and notification icons.

Right click on res folder and New > Image Asset. You can choose Launcher Icons, Action Bar Icons or Notification Icons in the Asset Type.

Update: You should look at this. It talks about white icon in notification.




回答6:


I face the same problem their is no issue with icon after Lollipop notification icon do not contains color icon it support flat,Silhouette icon supported.

  • Either you can change target SDK to 20
  • Or generate flat icon(icons8 is best option)

Or

you should use a condition

  boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
    return useWhiteIcon ? R.drawable.icon_silhouette : R.drawable.ic_launcher;



回答7:


Android Studios 2.2 has an Image Asset Studio that you can use to generate your icons.

https://developer.android.com/studio/write/image-asset-studio.html




回答8:


By default it will be grey color for any image. But you can customize it according to your color. Check below screenshot to select CUSTOM tab and then select color you want.

Hope it helps you.



来源:https://stackoverflow.com/questions/28807121/android-icon-generator-for-actionbar-and-notification-not-working-grey-shape

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!