Search code examples
androidbitmapnine-patch

Nine patch images look pixelated


I use several nine patch images in my layout, for buttons, text fields and form backgrounds. All of the xxx.9.png files are in the drawable-hdpi folder, just like the regular images, yet they still look pixelated.

The ImageView at the top has a regular bitmap and the lower ImageView uses a Nine Patch bitmap. You can see that the Nine Patch bitmap is scaled to a lower density. How do I fix that?


Solution

  • Ah, it was messed up because I was calling canvas.setDensity( 480 ) somewhere in a custom view. That caused this problem.