用填充重新定位ListView的滚动条 [英] Reposition scroll bar of ListView with padding

查看:76
本文介绍了用填充重新定位ListView的滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ListView,右边(和左边)都有填充.

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

当前列表看起来像这样:

Currently the list looks something like this:

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

最右边的线是屏幕的边缘,#是滚动条,右边的空白是右边的ListView填充.

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?

请注意,当前每行都有一个由适配器设置的单独背景,因为我正在为我的ListView制作一个浮动窗口,不幸的是,我的一个屏幕要求我执行此操作才能使其看起来像我想要.

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.

推荐答案

尝试一下:

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

这篇关于用填充重新定位ListView的滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆