Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reposition scroll bar of ListView with padding

I have a ListView with padding to the right (and left).

Currently the list looks something like this:

-----------------  |
| ROW         | |  |
|-------------| |  |
| ROW         | |  |
|-------------|#|  |
| ROW         |#|  |
|-------------| |  |
| ROW         | |  |
-----------------  |

Where the right-most line is the edge of the screen, with the #s being the scrollbar and the white space to the right of it being the ListView's padding to the right.

What I is for the scroll bar to be to the right of the padding like this:

                    _
-----------------  | |
| ROW           |  | |
|---------------|  | |
| ROW           |  |#|
|---------------|  |#|
| ROW           |  |#|
|---------------|  | |
| ROW           |  | |  
-----------------  |_|

Is it possible to move the scrollbar like that or will I have to change the layouts for each row to have an invisible border of the right size?

Note currently each row has a separate background set by the adapter, since I'm making a floating window for my ListView and unfortunately one of my screens require me to do this in order to get it to look the way I want.

like image 397
JPvdMerwe Avatar asked Jul 06 '11 09:07

JPvdMerwe


2 Answers

Try this:

<ListView
    ...
    android:scrollbarStyle="outsideOverlay" />
like image 90
Haisea Avatar answered Oct 28 '22 02:10

Haisea


add this to your list view

android:scrollbarStyle="outsideInset"

it will add a little padding and the scroll bar will be outside

like image 37
Abou-Emish Avatar answered Oct 28 '22 02:10

Abou-Emish