简体   繁体   中英

Android Studio adds white background to PNG image. How to fix it?

I have a PNG logo file that I want to display inside navigation drawer. But whenever I add the image asset to "mipmap", it adds white background and bounding boxes around the image. How to fix this?

Original Image:

在此处输入图片说明

After adding as image asset to Android Project's "mipmap" folder:

在此处输入图片说明

The 'mipmap' folder used ONLY be used for App icons. And these icons HAVE to have the same width and height. If they aren't, Android Studio will add extra white space to them.

Create a new icon that is square, but simply make some of the image transparent. Then you'll get your desired effect.

It is because the Shape property was set to Square by default. I changed it None , its fixed now. Thanks for responses.

运行应用程序(如果仍然显示),请使用PhotoShop制作png ..您的png不正确

The problem is when you add it as an image asset as launcher icon it adds white background to the image sometimes if the image isn't of the specified size. Use this option only when you're adding launcher icon, use action bar and tab icons option that won't add any white background to the image, select the theme holo_light theme will make the image dark, and holo_dark theme will make the image white, don't worry you can change the color of image of any custom color by selecting the custom theme while uploading or, you can use the android:tint attribute in the layout file. And add app related graphics in the drawable folder only.

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