skip to Main Content

So I am creating an android game and for the background I am using a gradient done in Photoshop. Now I know you can create a gradient via code in android but I prefer to do it this way. However, the image is supposed to look like this:

enter image description here

But instead ends up looking like this on the phone:

enter image description here

Why is the quality reduced?

2

Answers


  1. I think your mobile device display ability is the problem.

    In the market there are many displays with many display resolutions and with many ppi(pixel per inch) values.

    So consider above facts.

    Login or Signup to reply.
  2. I’m having the same problem. What I’ve read is that if you add some transparency that might fix it, like if you get the image and add an unnoticable bit of opacity using photoshop or something. This solution did not work for me however.

    Another solution I tried is when getting the bitmap I use bitmap options, setting inDither to true like so:

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inPreferredConfig = Bitmap.Config.RGB_565;
    options.inDither = true;
    Bitmap bitmap = BitmapFactory.decodeStream(inputStream, null, options);
    

    Of course you don’t need to use RGB_565, but that’s what got me the best (though not ideal) results. Also this works if you’re using decodeResource as well, only instead of the stream you’d put in the resource.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search