SweepGradient and Banding

by Shane » Fri, 26 Feb 2010 01:52:40 GMT


Sponsored Links
 Hello,

I'm writing an android app to that among other things lets a user
choose a color using a color wheel that is drawn using a SweepGradient
shader.  The shader is set up as follows:

        mColors = new int[] { Color.RED, Color.MAGENTA, Color.BLUE,
Color.CYAN, Color.GREEN,  Color.YELLOW, Color.RED };
        Shader s = new SweepGradient(0, 0, mColors, null);

I assign that shader to a Paint object which I then use inside of a
onDraw callback in a custom view to an oval using the paint/shader
object.  Here's the problem...

If I use that view inside of a Dialog and display the Dialog the oval
displays great, all colors in the gradient seamlessly blend together.
However, if I use that same view on its own the same SweepGradient
looks banded especially between green->red, magenta->blue, blue-
changing dither makes no difference.  I'm at a loss as to what to try,
I'm hoping someone has some clues on this.

Oh and BTW, this same behavior happens in the emulator or running on
my Motorola Droid.

Thanks

--



SweepGradient and Banding

by Gaunt Face » Sat, 27 Feb 2010 05:37:31 GMT


 Heya Shane,

I've had a similar problem with gradients applied to backgrounds, what
I found the issue was, was I had didn't have the drawables in the
correct dpi folder.

While I know your not using a drawable it might be worth looking into
whether changing the AndroidManifest file to state your app handles
different screen sizes.

I don't know if this is the problem, especially considering the dialog
view working, but it might be worth a try:

// Add just underneath the Manifest tag

<supports-screens
          android:largeScreens="true"
          android:normalScreens="true"
          android:smallScreens="true"
          android:anyDensity="true" />




--


Sponsored Links


Other Threads

1. Brightness through seekbar.pls help

HI,
 i have gone through the settings app of android application on git.
major java files to implement the brightness functionality through
seek bar  are
BrightnessPreference.java
DisplaySettings.java
Display.java

can i use this .. i m trying very diff approaches to get the desired
effect..pls suggest.
i just want to implement for the image view to +/- the brightness.

-- 

2. AppWidget Problem

Hi All,

I have been working on creating AppWidget for my application.
I contains 4 images and I need to change them at an interval of 30
sec.
I was able to achieve it using service and it is changing at an
interval of 30 sec.
The problem is that it does hang for the period where the images of
the widget change.
The home screen of android hangs for the period when updating the
widget.
Any gesture appears to hang for that period.

The other implementation that involves AlarmManager does not work.
I took an example from the link
http://android-er.blogspot.com/2010/10/app-widget-using-alarm-manager.html
but it does not update the TextView after it is placed on the android
home screen (launcher).
I am not able to figure out anything related to AlarmManager.

What should I do?
Please help

Thanks
Vivek

-- 

3. display brightness

4. Help in ExpandableList

5. Galaxy Tab + external screen : how to detect events from the right screen ?

6. (FaceDroid-id) WTShare HTC HD 2 does Android for noobs

7. How to identify which client called into a Remote/AIDL service?