2

How do I give Spinner's ListView rounded corners? I am referring to the actual container of the list items, not the single items or the spinner itself.

So far it has corners like so:

enter image description here

I managed to use the drawable background, but that only styles the spinner's button. I need to give the actual dropdown a rounded style.

Michele La Ferla
  • 6,775
  • 11
  • 53
  • 79
Lukesoft
  • 953
  • 1
  • 12
  • 31

1 Answers1

-1

All you need to do is create a shape xml file in the drawables folder with code similar to the one below:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF"/>
    <stroke android:width="3dip" android:color="#B1BCBE" />
    <corners android:radius="10dip"/>
    <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

What defines the roundness of the shape is the radius value. The higher the value you give it, the more rounded will the shape be.

Once you have set this, you can then set the background of the listview to the shape you have created.

Take a look at this if you wish to have more information.

Hope this helps :)

Community
  • 1
  • 1
Michele La Ferla
  • 6,775
  • 11
  • 53
  • 79
  • This just explains how to do the rounded corners on the shape. It doesn't answer how to do it on the spinner? I.e. how to add that shape to the spinner popup? – Luka Bradeško Feb 17 '19 at 19:09
  • That was not the question. If you have a question on how to set the spinner container as rounded. Then all you need to do is set the spinner background to point to the drawable. – Michele La Ferla Feb 19 '19 at 08:37
  • if you set the spinner background to point that drawable, it will make rounded corners for the spinner itself, but not for the container after you click the spinner – Darksymphony Aug 23 '19 at 10:15