rounded corners in borders for ListView


Hi everyone!

To create borders with a rounded corner at the lower left corner of a ListView, I use a drawable xml file with <shape> attribute. Then I set it as the background of my ListView. It looks fine, but when I click the element at the bottom of the ListView (where the rounded corner is), the element is highlighted, displays the listSelector gradient I want it to, and by doing this hides the rounded corner at the lower left of the ListView's background. What I want to create is a ListView with borders and a rounded corner that DOES NOT get hidden when the last element of the ListView is selected / focused.

I know I can disable the background gradient set as value to listSelector, but then the user doesn't have any indication when an element is selected. Besides, I want to have this gradient! I also know that it's possible to set the border xml file as the background of a container (say, LinearLayout) and then give padding to the ListView within it. That will work, but it's not what I want! I want the ListView to span until the borders of the background file, such that when an element is selected, the entire area from the right border to the left border is highlighted with the listSelector gradient. Setting the rounded corner to a smaller size is also not an option.

How can I solve this problem? Is there no way to create a border with a rounded corner that will limit, or "swallow", any Views within it to its borders?