今天在干活的时候,发现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