Reposition scroll bar of ListView with padding

AndroidListviewScrollbar

Android Problem Overview


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.

Android Solutions


Solution 1 - Android

Try this:

<ListView
    ...
    android:scrollbarStyle="outsideOverlay" />

Solution 2 - Android

add this to your list view

android:scrollbarStyle="outsideInset"

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJPvdMerweView Question on Stackoverflow
Solution 1 - AndroidHaiseaView Answer on Stackoverflow
Solution 2 - AndroidAbou-EmishView Answer on Stackoverflow