1

I am attempting to create a nicely rounded list similar to the one shown below:

enter image description here

The items displayed will scroll when a user wishes to pass 6 items. I was wondering how I could make the recycler view, within this rounded cabinet, rounded at the top and bottom; such that an effect is created to match the draft displayed above.

If anyone could tell me how to round the corners of a recylcer view, cleanly without artifact, like this (within XML) it would be greatly appreciated. Just for information, I have tried something; that being the process of putting the recycler view inside a cardview and allowing the cardview to clip the recycler. However, this results in some weird pixel outlines (artifacts) at the bottom edge. I have shown it here:

enter image description here

You can see a set of stray pixels which, while not neccesarily too obvious, make it slightly jarring to view for both a user and myself

  • 1
    CardView ought to get you most of the way there (https://stackoverflow.com/a/8313096/208273) - I'm curious what artifacts you got with it – Ryan M Jan 27 '23 at 19:28
  • I'll add an image to my post so you can see what I mean – CGI-Demon402 Jan 27 '23 at 19:31
  • 1
    I...wonder if that might be a bug in CardView :-\ it can be really easy to accidentally get artifacts like that with outlines, especially if you're targeting older API levels (it's easier, if I recall correctly, if you can target at least Lollipop, though I don't remember the details). At any rate, definitely not what you want it to look like. – Ryan M Jan 27 '23 at 19:44
  • 1
    The basic issue that causes this is trying to clip the content at exactly the path of the outline. It doesn't work because of anti-aliasing. Fixing it can be very fiddly (if I recall correctly, I found a compromise that looked pretty close to correct with the colors I had, but wasn't perfect). It's a good question how to fix it. – Ryan M Jan 27 '23 at 19:46
  • I see, well I am not really too fond of the idea of changing target API; but, if you find a workaround that isn't too fiddly do let me know. I'll keep hacking away on my end to see if I can get anything a little nicer, though it is a tricky task. – CGI-Demon402 Jan 27 '23 at 19:48

0 Answers0