png image showing up with grey background in android - android

I have some png image buttons that I use in my app. But they are showing up with grey backgrounds on my page. Does android always show a grey background for a transparent one? Is there a work around?
This is how it showed before.
This is how it shows after I made #FF000000 edits
This is how I want it to show.
EDIT:
Error when I use #FF: Color value not valid -- must be #rgb, #argb, #rrggbb, or #aarrggbb (at 'background' with value '#FF'). main.xml

#android:color/transparent. Phoenixblade9 was close.

If the image is transparent, there should be nothing shown behind the image.
The default colors vary from distribution to distribution. The color scheme/theme for an HTC phone will be different than from a Motorola phone, or the emulator.
If you want to ensure that a view has a transparent background, set the following in your XML code for that view:
android:background="#android:color/transparent"
This should ensure the background is completely transparent.

The code line in the ImageView or ImageButton in the XML file is actually:
android:background="#android:color/transparent"
I am writing this to help someone who is not familiar with the platform and won't connect the two answers above.

I found this happens if you have android:src="#drawable/mypngimage" in your xml file. Instead if you use background then the gray area goes away and it behaves as expected. android:background="#drawable/mypngimage"

Please check whether your image is 32 bit depth or not. After that insert this code in your image view: android:background="#android:color/transparent".
To make your image transparent open Adobe Photoshop or Illustrator, open file (i.e. your image) and click file and click to export - save as web (legacy), tick transparent and save it.

Also you can use #50FFFFFF (aarrggbb). in this format, aa is alpha channel to be transparency frequency. So If you use above color, you get a 50% transparent white background.

Related

How to make a specific colour in an image transparent in Android studio?

I'm using an image that has the letters "LYIT" and a white background. I want to make the white background transparent so only the letters are visible.
I've tried android:background="#android:color/transparent" but it only changes a small portion of the image Logo.
app:tint="#color/colorWhite" doesn't work either.
Is there a way I can target the white portion of the image and make it transparent?
Also, I'm writing my classes in Kotlin.
Thanks
I found this answer at another question,
you can write the following code in the backend
val image = findViewById<ImageView>(R.id.*write the id of the image here*)
image.background.alpha = 0 //the value of alpha's range is [0,255], 0is transperent and 255 is quite opaque

Removing Grey and White Chequered background in Android Image Asset Studio

I am trying to remove the Grey and White Chequered background from a launcher icon jpg file using Android Studio's Image Asset.But no luck so far.
Is there any way to do this?
below is the Background :
The checkerboard background is for transparency. Same happens in paint.net. If you end up with transparency, you get a checkerboard like that of white and grey.
It is technically not a background, you don't actually see that in the launcher. Alpha shows as a checkerboard to ensure you know you are seeing alpha. If you install it on a device, you can see what is "under" the launcher icon. If your icon is 256x256, and has a 10x10 square of transparency in the middle, you will see a checkerboard there too. If you then launch it on the device and check the launcher, you will see that there is a see-through hole in the middle.
Basically, the checkerboard isn't a background - it is transparency.
With the exception of the times where you actually create a checkerboard on purpose, but that can then be deleted by modifying the .png file
Right-click on image, form the menu that pops up select Hide Chessboard.

How can I get rid of transparent background space in (Android Asset Studio - Icon Generator)?

When I upload my image (which has no background to begin with), it is automatically given transparent background no matter what settings I choose. I really like the "Square" shape (rounded corners) but there is way too much excess transparent background. When I see the icon on my phone it looks so small compared to Facebook for example. How can I get rid of this extra background space to make it as large as possible? Is one of my settings off?
http://reiszecke.github.io/AndroidAssetStudioFullsize/
Just click on >> Launcher icons << Full Size edit
pls mark as answer if it helped.
EDIT: only works on "bevel" and "none", I will adjust the other shapes at some point
http://www.gieson.com/Library/projects/utilities/icon_slayer/
Does the job but the an image must be provided first.
Creating the logo and background with LIG and loading the result in the gieson's icon_slayer should do it.

App Icon with transparent background doesn't appear transparent on device

I created an app icon on GIMP with transparent background and double checked the transparency by pasting the icon image on colored pages in word editors. I went ahead and used the icon image and created the apk file. However, after installation, the icon background is not transparent on the device(LG Optimus S) screen. Has anyone ever had this issue? Thanks in advance for any suggestions or ideas.
I had the same issues, but I used Paint.NET on Windows.
When saving the image, I used the Auto-Detect setting for PNGs, but changing this to 32-bit solved my problem.
I tried saving my image as a 24-bit PNG too but this produced the white background and wasnt transparent.
Maybe try 32-bit PNG....
(my trials were done by inserting image into PowerPoint slide which had coloured background)

Android Transparent png doesn't show as transparent

I'm using an image with transparency as a ImageButton in my Android app - but when it appears on the android screen - it still has a whitish surrounding border.
I even changed the image to one of the template ones supplied and that still is not transparent (although it is in photoshop).
Am a missing some declaration or something ?
I tried in both the emulator and also running on my phone and its still shows as white on the black background.
Cheers
ScottyB
The whitish color IS the button part of the image button :)
Use regular Button and set your image as the android:background of it. Don't set any text.

Categories

Resources