Android Transparency bug? android:color/transparent - android

Random bug on mostly > 4.0 devices
Sometimes transparency that is set in .xml files is shown as white/light grey shade.
This happens for practically everything , TextView , ImageView , Button , Relative Layout...
Has anyone experienced this before ?
All I can find is a transparency bug in Jelly Bean that happens with secondary accounts , which isn't related to this.

I ran into the same issue, but was able to work around the problem by using the 8-digit color code in which the first two digits represent the transparency level (00 being fully transparent, FF being fully opaque).
Using #00000000 results in a fully transparent color and can be used as a direct replacement for android:color/transparent.

Related

White text color on Pixel 6 android

I have an app available on play store and users have been reporting that they can enter any text due to the fact that the text color is white, which very weird.
I have used Firebase Test Lab to try reproduce the issue. I could indeed reproduce it.
On Pixel 5, everything is fine and the input text on EditText is visible. Text is black and background is white.
On Pixel 6 on the other hand, there is nothing to see.
I have not set any text color on the edit text, so everything is out of the box.
Unfortunately there is not yet an Emulator for Pixel 6 in android studio. Therefore I can't really debug to see what's going on.
What is so new on Pixel 6 that sets white as the text color?
Best regards
I manage to solve the problem.Changing the parent of my style from Theme.MaterialComponents.DayNight.NoActionBar to Theme.MaterialComponents.Light.NoActionBar did the trick.

Why is setImageResource changing the color

I'm working with android and trying to use an image button. Everything works fine, the only problem is that when I display the image on the emulator, the buttons background color is different then the background of the app. I'm on my mac and I'm using Paintbrush to create the image, and the Digital Colorometer to check the RGB values. Everything checks out, the images have the same background RGB as the image, but one run on an emulator, it lowers them from (84,20,109) to (62,0,86). The colorimeter also says "(clipped)" next to the green value. I'm not sure why this is happening and it certainly is annoying as the buttons clearly stand out now. Is this because of the emulator or is something else happening?
Thanks for any help
Also: I have tried both, using setImageResource, and using android:src. Both have the same result shown above.
I figured out what was wrong. It turns out that my emulator was lowering the color values by 20. I resolved it by setting the background color to exactly what it is in the app.

Can't set background for TabWidget android

I searched a lot but could not find specific solution for my problem. I am posting a screen shot where you can see a tab widget. Also there is an exclamation mark there don't know why! You can see on the right bottom corner there is Background set to drawable. I have put the same named drawable into x,m,l,s, dpi folders. Also you can see in the Screen shot that there is API 8 used. Now the problem that I am facing is I can see the background set for 4.0 but not for 2.2! I have used setBackgroundResource also in class file, I tried to set alpha 0 for this tabwidget also. But don't know why its not taking my image as its Bg for API 8!! Thanks all would appreciate any relevant help.
i did try it like you and same result.. with normal tabhost on api 8.
But finally i did download :
http://code.google.com/p/android-custom-tabs/downloads/detail?name=customized-tabs.zip&can=2&q=
And as sample edit tab_bg_unselected.xml change it to transparent instead of that gradient.
put a solid element with android:color #android:color/transparent and it would be transparent after.
Then set a backgroundimage to the tabhost and its working nice.
Author article is : http://joshclemm.com/blog/?p=136
I think this is a very good solution and you could even make greater customization with that one.
Its a nice workarround, hope you could like it :)
Here a screenshot on a real 2.2.1 Motorola Milestone
Note : Did even verify it on latest Nexus 7 4.3 tablet and S2 4.1.2

dark grey color appearing in some random scenarios in the background of views in android

It is occurring in random scenarios and some time its happening to all the views and some times for few among many.May be because of either memory or graphics issues.Any solutions please....
It happened to me after I upgraded my Samsung Galaxy S3 software. Maybe the problem it's the basic light theme that has a light grey color instead of white for background.
The only solution I found for that is to manually set white color as background of all the layout containers in my application.
Hope that helps.
I have the same effect on a S3 / S3 Mini phones, to solve this bug just remove "android:colorBackground" from activity theme. My problem was that I wetted colorBackground and windowBackground together for some strange reason S3 applies both but with some alpha channels (my original colors does not have alpha) and when you apply 2 colors with alpha the color multiplies. I do a testing also setting color in a Activity and gives another color of background so just removing all colors Fragment Root layout + Activity root layout and setting only a windowBackground instead of colorBackground solves the bug for me.

png image showing up with grey background in 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.

Categories

Resources