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.
Run the app - if it still shows - use PhotoShop to make the png.. your png is not made correcty
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.
Related
I have tried changing different settings, using different image sizes and using different image shapes but nothing has worked. Do I need to add a version with rounded corners to my android studio file?
Right click on drawable folder > new > image asset.
In the asset studio it will automatically generate the app icon shape, you just have to pick your transparent logo on the foreground layer and pick the white color on the background layer. So no need to provide rounded corners version
I'm trying to implement a launcher icon for an Android app. I'm using Android Studio's New Image Asset capability to create the icon from an image file and it works in most places except for the later Pixels.
On the Pixel 3XL, it looks like the following figure. The icon with a round white border around it.
On the Pixel 2, it looks the same
But on an original Pixel, it looks right:
I created the icon assets using the Android Studio New Image Asset capability. Selecting the image icon as shown in the following figure:
Then I set the background to the background color for the icon:
Based on what the UI shows, the icons all look right and Android Studio is supposed to generate the right files for all target platforms. Can someone please help me understand what I need to do to get rid of that white border on later phones?
You should add ic_launcher_foreground.xml and ic_launcher_background.xml to drawable file in your project. As far as I get it, you've try to make red background then add red backgorund layout you have only foreground image in this way. Btw that is not a bug that is a feature :)
so I want to make icon for push notification. say for example I want to use the android image below as notification icon
https://p7.hiclipart.com/preview/135/689/279/android-computer-icons-logo-android.jpg
so I try to make it using Android asset studio. but the image generated from this Android Asset studio is completely white like this
what should I do ? is there any image requirement for this ?
Use Transparent Images
The icons generated will be totally solid color (dark grey or white will be used on the device depending on theme).
The icon you add should only contain the "shape" you want to show as the single color. The rest should be transparent pixels.
Any non-transparent pixels will be converted to white. So if you have a square logo with no transparent pixels, it will be a giant single colored square.
Use a .png image so you can save it with transparent background.
As you can see, icons in notifications bar are white, that's why you are seeing all white
My application uses png images like this:
navHomeTabPage.IconImageSource = "ionicons_2_0_1_home_outline_25.png";
My code changes the icon color here:
android:TabbedPage.BarItemColor="{DynamicResource LabelTextColor}"
android:TabbedPage.BarSelectedItemColor="{DynamicResource
DroidBarSelectedItemColor}" TabBar.SelectedImageTintColor = UIColor.Red;
But can someone explain to me, how is the color changed. I though a png image already had just one color, so how does Android or iOS change this to a different color?
How about for svg? Do the mobile apps do a better job of changing a png or svg image? Is it better to use one than the other for a Botton navigation tab area?
For iOS, the tab bar on iOS won't use the image's original color by default. From this documentation, it says:
By default, unselected and selected images are automatically created
from the alpha values in the source images. To prevent system
coloring, provide images with UIImageRenderingModeAlwaysOriginal.
It means it will create a new image from the source image and use the system color or you can set the colors using the code above: TabBar.SelectedImageTintColor = UIColor.Red;. If you want to display the original image's color, you have to create a custom renderer for TabbedPage, and replace the icons with the api: UIImageRenderingModeAlwaysOriginal.
For Android, the bottom navigation page will create an extra layer called BottomNavigationView to control the color. It overlaps the original icon to show the colors you set using:
android:TabbedPage.BarItemColor="{DynamicResource LabelTextColor}"
android:TabbedPage.BarSelectedItemColor="{DynamicResource
DroidBarSelectedItemColor}"
If you prefer the original color, you can remove its ItemIconTintList in your custom tabbed page's renderer. See this thread: https://forums.xamarin.com/discussion/comment/376630#Comment_376630 for more information.
So I'm trying to add an image which has a width of 300 pixels and height of 100 pixels (which I can easily change if need be):
I want to replace the 'app icon' that appears in the upper left of the ActionBar of the Android documentation to use my logo instead of the app launcher icon. However when I right click Android Studio click 'New' and then 'Image Asset' and set the following:
Asset Type: Action Bar and Tab Icons
Foreground: Image
Theme: CUSTOM
Foreground color: [0,0,255] which is slightly different from my logo color, but I leave it be since it's default
The foreground color washes over my actual image:
How do I add my logo as an image asset such that it scales nicely & automatically for MDPI, HDPI, etc to be used to replace the default launcher icon in the upper left without me having to create custom image sizes for each in an image editor?
I'm not sure what you mean by setting a foreground color for the logo.
Using a logo in place of the app icon is really simple. Just specify the android:logo attribut on your application tag in the manifest, and set your android:displayOptions for the action bar style to useLogo.
<style name="ActionBarStyle" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:displayOptions">showHome|useLogo</item>
</style>
In terms of where to put your image, you want to work out which dpi bucket is correct for your image, and then put it into the correct folder. You could do this by trial and error. Simple copy your image to the res/drawable-xhdpi folder, and see what it looks like. Android will handle scaling the image for you.
Simple as this:
Just drag and drop your wanted .png, .jpg ... file to the AndroidStudio project explorer -> res -> drawable