0

I want to give my ListView rounded corners and some padding. Here is my style:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
  <solid android:color="@color/white"/>
  <corners android:radius="10px"/>
  <padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" />
</shape>

But when I create a divider its width is not from one end to the other but looks like this:

enter image description here

I create the divider like this:

<ListView android:id="@+id/livList"
                      ...
                      android:divider="@color/bordeaux"
                      android:dividerHeight="1px" />

Any ideas how to tell the divider to strech from one end to the other?

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
Ron
  • 22,128
  • 31
  • 108
  • 206
  • 4
    adding screenshot would be better – R9J Jul 05 '13 at 09:50
  • I tried to answer your question. Frankly your question is just not clear. Please edit so that we waste less time trying to understand it. – Siddharth Jul 05 '13 at 10:21
  • Sorry, but have a look at the screenshot. There is a white space between the red line and the border of the `ListView`. I need the divider to strech over the whole width of the ListView... thats all. – Ron Jul 05 '13 at 10:22
  • 1
    If that so, why are you adding padding on your drawable? – hardartcore Jul 05 '13 at 10:26
  • So you mean giving the SubItems a padding and not the container? – Ron Jul 05 '13 at 10:58
  • @Android-Developer: So easy and so great :) If you post an answer, I'll accept it – Ron Jul 05 '13 at 11:07

2 Answers2

1

I will add an answer with the solutions from comments if anybody else have the same problem.If you want your divider to fit the whole ListView just remove paddings set in your drawable in xml. And just another thing: while trying to style ListView items, you need to 'work' on xml file which contains views which you are using to populate current item.

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
hardartcore
  • 16,886
  • 12
  • 75
  • 101
0

Dude you've entered right, left paddings as 5dp. Remove left & right paddings or make them 0dp

imthegiga
  • 1,126
  • 8
  • 13