Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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             |            |          | +------------------------+------------+----------+ 
like image 756
User7723337 Avatar asked Feb 06 '12 12:02

User7723337


People also ask

How to give space between scrollbar and content in Android?

Set scroll bar style as outsideInset and then add scroll bar padding to right. Save this answer.

What is scroll padding?

CSS Demo: scroll-padding This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars), or to put more breathing room between a targeted element and the edges of the scrollport.


2 Answers

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!

like image 149
User7723337 Avatar answered Sep 19 '22 10:09

User7723337


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.

like image 40
Tvd Avatar answered Sep 20 '22 10:09

Tvd