Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ListView scrollbarStyle with margin/padding

Hopefully a simple one. v4.0.3

I have a ListView and want to leave a margin of 10dip right and left. The content is easy of course, but I want the divider line to have a 10dip margin right and left too.

If I add android:PaddingRight or android:layout_marginRight to the ListView or the LinearLayout which contains the ListView then this works of course, but the List scrollbar which appears down the right hand side as you scroll the list also moves in by the padding/margin distance.

I want the scrollbar indicator to remain. I've tried all the android:scrollbarStylesettings.

like image 609
MartinS Avatar asked Feb 09 '12 10:02

MartinS


1 Answers

Can do easily

<ListView
    android:id="@+id/lvDonorDetails"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:divider="@drawable/list_divider"
    android:dividerHeight="1dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:scrollbarStyle="outsideInset"/>

Or

<ListView
    android:id="@+id/lvDonorDetails"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:dividerHeight="1dp"
    android:padding="10dp"
    android:scrollbarStyle="outsideInset"/>
like image 159
Dinithe Pieris Avatar answered Oct 22 '22 05:10

Dinithe Pieris