Cody
Cody

Reputation: 8964

Why does the drop shadow in my 9 patch look bad?

Instead of fading from dark grey to white, there's an odd gray border around the shadow/whole image when using my 9patch. Is there some sort of limitation to graphics?

I created a simple 100x100 image, with a rounded rectangle and a drop shadow / stroke in photoshop. Then, I used the 9Patch tool and just selected 1 px from each side.

On the Emulator, it looks okay. I can't tell if it's there or if it's the screen. On a Cisco Cius, it is very visible. It seems as if there is a drop shadow, but lining around the entire image is a gray border 'behind' the 9 patch. It's much fainter on the screen (the picture below doesn't show it well). Is it a limitation of the hardware perhaps?

Ex

9 Patch

Upvotes: 1

Views: 2520

Answers (2)

caguilar187
caguilar187

Reputation: 763

try adding RGBA_8888 to the top of your activity. Your image contains a gradient and in my experience setting the format to the above fixes it. the good new is RGBA_8888 will be the default starting in ICS for all devices.

@Override
public void onCreate(Bundle savedInstanceState) {
    getWindow().setFormat(PixelFormat.RGBA_8888);
    super.onCreate(savedInstanceState);
    setContentView(Res.layout.toplayer);
}

Upvotes: 3

Brigham
Brigham

Reputation: 14564

Occasionally, Android builds can get into a state where all the nine-patches look awful. Try cleaning your project and rebuilding.

Upvotes: 0

Related Questions