4

Hey all, what would be best practice for clipping the bottom borders of a Bitmap? Just manipulate the Bitmap itself or overlay an alpha mask drawable or ...?

The whole story:

I've a Listview which looks like the iPhone's grouped UITableView style. I would like to display a Bitmap in the last row, but for now the Bitmap overlaps my custom background drawable of the Listview cell.

Thx in advance!

alexleutgoeb
  • 3,123
  • 3
  • 20
  • 31

3 Answers3

4

Fyi: I've found this code snippet: http://www.ruibm.com/?p=184 .

As in my case, I only wanted the bottom corners to be rounded, so I added an additional drawRect (with smaller height than the drawRoundRect) to the canvas.

alexleutgoeb
  • 3,123
  • 3
  • 20
  • 31
0

I think your answer can be found here: How do I create a ListView with rounded corners in Android?

Community
  • 1
  • 1
RickNotFred
  • 3,381
  • 2
  • 24
  • 26
  • 1
    Sry, not really, this thread shows how to set a custom background to the listview (what I've done in a similar way actually), but the content does not get clipped anyway, so my Bitmap would still overlay the rounded corners. alex – alexleutgoeb Feb 12 '10 at 23:33
0

I needed to do the same thing - but I wanted to do it right in the XML, rather than java code.

I have explained what I did in an answer on this question: Android XML rounded clipped corners.

It was the masking that appealed to me - it can be overlaid over any layout, with minimal problems. Very easy to scale over a whole project, and to change the exact masking, by just modifying one 9Patch masking file.

Community
  • 1
  • 1
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255