关于GridView里面的一个padding

在处理GridView时遇到内容偏左的问题,原因是右侧scrollbar导致的paddingRight。通过查看SDK文档,了解到android:scrollbarStyle属性可以控制scrollbar样式和位置,设置为overlay即可解决。

今天在干活的时候,发现gridview里面的内容偏左。用hierarchyviewer发现有个paddingRight,但是怎么也找不到在哪里设置的。

后来发现是因为右侧有个scrollbar,导致会加padding。


下边一段摘自sdk文档,已经说的很明白了,因此改成overlay就好了。


android:scrollbarStyle

Controls the scrollbar style and position. The scrollbars can be overlaid or inset. When inset, they add to the padding of the view. And the scrollbars can be drawn inside the padding area or on the edge of the view. For example, if a view has a background drawable and you want to draw the scrollbars inside the padding specified by the drawable, you can use insideOverlay or insideInset. If you want them to appear at the edge of the view, ignoring the padding, then you can use outsideOverlay or outsideInset.

Must be one of the following constant values.

Constant Value Description
insideOverlay 0x0 Inside the padding and overlaid
insideInset 0x01000000 Inside the padding and inset
outsideOverlay 0x02000000 Edge of the view and overlaid
outsideInset 0x03000000 Edge of the view and inset

This corresponds to the global attribute resource symbol scrollbarStyle.

Related methods:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值