User7723337
User7723337

Reputation: 12018

How to put padding/spacing in-between list view item and scroll bar [Android]

I have a ListView where I want to put spacing/margin/padding in-between list view items and the scroll bar.

:ListView:
+------------------------+------------+----------+
|List Item 1             |            |          |
+------------------------+            |          |
|List Item 2             |----Space---|  Scroll  |
+------------------------+            |    Bar   |
|List Item 3             |            |          |
+------------------------+------------+----------+

Upvotes: 32

Views: 12686

Answers (3)

User7723337
User7723337

Reputation: 12018

I have found the solution:
Set scroll bar style as outsideInset and then add scroll bar padding to right.

android:scrollbarStyle="outsideInset"
android:paddingRight="10dp"

That's it!

Upvotes: 71

Tvd
Tvd

Reputation: 4601

I wanted teh same with my TableLayout. Padding helped me out. For yuo it should be :

android:paddingRight="10dip"

YEs. If you add ListView in ScrollView, your listView will scroll with ScrollView.

Try this. Hopefully it will give u your desired results.

Upvotes: 2

vgonisanz
vgonisanz

Reputation: 11930

You must use Fragments.

1º You load your content view, with 3 vertical layouts

2º Then, use 3 fragments that you want, in different xml, and load the content in each one.

3º Set the margin between layouts.

You have a good example Here

Upvotes: 0

Related Questions