I am having problems getting transparency to work well on an ImageView. The images at (http://img265.imageshack.us/img265/6233/whatn.png) were screen captured from a Droid (hdpi). The top image I made in Photoshop and left the background white. The bottom image is the same image with the background transparent and the layout's color (white) shows through.
Whenever I have transparent backgrounds in images it dithers shadows like this. Also, it only happens on hdpi devices, on my G1 (mdpi) it looks just fine. What is going on? How can I make the bottom image look as good as the top one?
Try setting the window PixelFormat in your Activity
getWindow().setFormat(PixelFormat.RGBA_8888);
In older device and simulator, you should use png image with transparent channel. Try re-open your image and save as with a transparent channel.
Related
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.
Dear Fellow Developers,
I've ran into the problem shown in the attached picture. We have been trying to tweak the dropdown menu's 9patch image provided by a graphics designer, but could not get it to work. The black stretch markers are not being hidden, and Android does not stretch it the way we would expect.
The device is a Nexus 7. We have tried several various image sizes, but none seemed to work. I am also attaching a copy of the 9patch.
What could be wrong?!
This happens:
Here is the 9patch
If the image has been created in a normal image editor rather than the android 9 patch tool, it could be just that its not done exactly right.
The image must have a 1px transparent border other than where the black lines are. Make sure its completely transparent and is only 1 px thick
Also I don't think you can have split lines (like you have down the left and right side of the image, I think they must be one solid line on each side)
I'm trying to use a 9-patch png for a Spinner, but the image isn't stretching as expected. I used Android Asset Studio.
Here's what the Spinner looks like:
http://i.imgur.com/MOXCccq.jpg?1
and here's what the 9-patch looks like:
http://i.imgur.com/gd6ywAu.png
The placement of the image is correct (it should be in the bottom right of the spinner), but I'm not sure why the color distortion is occurring (I want the entire spinner to be white).
Any suggestions? Thanks.
Your 9-patch is the problem. Looks like you downscaled this from a larger source? During the downscaling, your edge pixels were aliased:
So your stretch points are actually on semi-transparent pixels. Just fix those edge pixels to be white again and you'll be good to go.
I am having a View and i have placed a background image.Taking the snapshot works fine in this case.
But i setAlpha to make background image semi transparent then snapshot becomes blackish in color depending on how much I am making it Transparent.
How to programmatically take a screenshot in Android?
having seen this link but doesn't help much with this case.
Any help?
if you put an alpha color the screen shot will get a non-color (black) mix on it, always.
If you want a screen shot, and keep your alpha, you'll probably have to remove the alpha, wait it to render on the screen, get the screen shot, and then change it back to alpha.
I know cause I've used this before in an application.
I'm using PNG images with transparency in my game and no matter what I do the edges of them get all grainy looking.
I have tried setting the following in my activity with no luck:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DITHER, WindowManager.LayoutParams.FLAG_DITHER);
Is there anything I can do in Photoshop or in my game to overcome this. Please see the image here:
It looks like your image is too low a resolution and the edges are not tidy, there is some white left over from when you deleted the background.
Open the image in photoshop, zoom right in and fix your edges. Probably best to redraw and resize again for the screen you are using.