I have a menu screen, with an animated background layer. This background is calculated runtime, hence it is not a simple sequence of images, and it uses graphic elements that are used inside the application itself.
As soon as these graphics elements are studied to be very colourful and visible, the background animation sometimes makes the menu that is on the foreground a little confused.
So, I have to reduce the contrast of the background animation.
What is the best practice to reduce the background contrast/brightness without changing the graphic elements? (or maybe blur the background layer)
And more, would it be possible to reduce the contrast/brightness ONLY on a portion of the screen, the one below and around the menu buttons, and leave the rest of the screen as it is?
Thank you very much.
You can make the menu layer larger (think of it as a "padding" around the menu itself); if that "padding" is dark (black or close to it, depends on the effect you want to achieve, maybe even 50% gray if you only want to reduce contrast) then you can set its alpha value to something that achieves your effect of "dimming" the background. Or let the "padding" have an alpha gradient so the darkening fades out/the background fades in.
Related
I would have thought that there would be a variety of options in connection with a button's background from an image, for example the image could be tiled, or stretched or centred etc etc, but when I list a button's methods I can't see anything. Now I'm suspecting that it could be a two stage process, perhaps getting some kind of view first and then using a method of that view. Or maybe there is simply no control whatsoever concerning a button background. Please advise.
Note that any View's background is something that fills the area covered by that View, so you can't have it centered.
Stretching the the default behaviour, that's why a state list of 9-patches the the best thing to use for Button's background.
If you want tiled background, you may use XML Bitmap with tileMode="repeat". See also other kinds of Drawables on this site. You can for example make something that feels like centered background image using Inset Drawable.
And finally the functions are there: setBackgroundDrawable and setBackgroundResource.
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.
Looking for advice with the next problem. I am developing small game and I have a *.png file for background. I need to put it to background of the main game screen. Moreover, it has to bee 2 times bigger in width and 1.5 times bigger in height as the screen's sizes, because my objects "flight" across these borders. Additionally the screen is moving around this background in a gameplay. But I have stuck a bit on how to do it.
I want my background to look similar on all screens with different sizes and densities. I have tried some solutions but I don't like them, or I have made something wrong:
Make different background images and put them in special folders. It sounds good, but with the amount of resolutions of Android devices in the market it is not sounds good for me. It will just make the size of *.apk bigger. And if I will use the methods to set background it will stretch the image - not a good idea I think.
In the onDraw() method draw the image on canvas. I have to put it's top-left corner to the most top-left corner of the possible game area and draw it. But, here is some options:
cut from the main image the image i want and draw only this piece (what I use now)
resize the image I have and draw with this changes
something else...
So, the question is: what is the best option for drawing background for the game screen when you need it to be almost twice bigger than the screen's size, make it looks same on all devices and move the screen around when the game is played?
you should use 9 patch image .
A NinePatchDrawable graphic is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background.
see this link.
http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
I use a navigation-based iOS application. I want to make a background similar to desktop wallpaper in Android.
So when I go to another View the current View and it's content goes outside of the screen but the background image slightly moves only.
See a sample screenshot here.
Why not have the base subview set to the size of the background wallpaper (ie larger than the screens width) and start with it left aligned. Then have a paged UIScrollView on top of that. When the user scrolls the UIScrollview, hook into the UIScrollViewDelegate method
- scrollViewDidScroll: and pass it through the the base subview, telling it to animate in accordance.
This shouldn't be too hard but you'll probably want to tweak it a bit to get the feel you want.Try playing about with the various delegate methods in the UIScrollViewDelegate protocol to determine the best time to start the animation.
I have a ListView that has a subtle gradient bitmap in the background of each item. I noticed that when I scroll the list, the background gradient becomes banded and changes color. The gradient is a dark gray and when it scrolls is becomes subtly green and banded. It basically looks like the quality of the images greatly decreases as it scrolls.
Most of the time, as soon as it finishes scrolling, it returns to the normal quality. Sometimes it actually stays poor quality even after scrolling stops. On a Nexus One it almost always stays low quality after scrolling.
Is there a way to avoid this?
Note: This is not the common ListView background problem discussed here: http://developer.android.com/resources/articles/listview-backgrounds.html
Here is an enlarged screen cap to show the difference. On the left side is the background normally. On the right half you can see what it looks like when it scrolls.
You need to add android:cacheColorHint="#0000" to your ListView in xml.