2

I have an ImageView with 40dp x 40dp dimensions. In drawable-nodpi there's a 100px x 100px png, which I use in the ImageView. These numbers are made up for simplicity. The problem is that Android downscales the 100px with a terrible quality, it certainly doesn't use filtering/antialiasing (whatever the correct term is). Is it possible to force it?

fhucho
  • 34,062
  • 40
  • 136
  • 186

1 Answers1

-1

Try setting android:antialias="true", like so:

<ImageView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/icon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:antialias="true" />

taken from here.

Community
  • 1
  • 1
skynet
  • 9,898
  • 5
  • 43
  • 52
  • Thanks, unfortunately this dooesn't have any noticable effect. – fhucho Oct 29 '11 at 08:34
  • 1
    After using a 100x100 test image scaled down to 40dp, with or without antialiasing enabled in the ImageView I did not notice any difference either. You could try doing something similar to [this](http://stackoverflow.com/questions/6087019/drawing-scaled-bitmaps-on-a-surfaceview-no-antialiasing/6088084#6088084) but it looks like even that didn't help. – skynet Oct 29 '11 at 18:10
  • I decided to create prescaled bitmaps for ldpi, mdpi and hdpi and it now looks ok. Perhaps the problem was that my image was on top of another drawable, which is dithered. Thr image was pixelized on it's edges (it is a shape on a trasparent background). – fhucho Oct 29 '11 at 23:17