如何同时保持页面全宽度设置ViewPager页面之间的填充 [英] How to set padding between ViewPager pages while keeping the page full-width
问题描述
我使用的是新的 ViewPager
-view从Android兼容性库,我想不出如何让页面之间的填充,这样,当你重新它们之间的刷卡,有一个明显的边界。
I'm using the new ViewPager
-view from the Android compatibility library, and I can't figure out how to get padding between the pages so that when you're swiping between them, there's a visible border.
我的 ViewPager
宽度设置为 FILL_PARENT
所以它占用了显示器的整个宽度。在 ViewPager
,但已增加(不必要的填充:我可以通过设置安卓得到页之间的边界降低了页面的可见大小当它被完全显示的)效果
My ViewPager
width is set to fill_parent
so it takes up the entire width of the display. I can get this border between the pages by setting android:padding
on the ViewPager
, but that has the added (unwanted) effect of reducing the visible size of the page when it is fully displayed.
我想我需要的是引入边框视图的宽度以外不知何故,如果即使是有道理的......
I guess what I need is to introduce a border outside the width of the view somehow, if that even makes sense...
在新的Android市场这样做我喜欢的方式,但我只是无法弄清楚它是如何实现的。
The new Android Market does this the way I'd like, but I just can't figure out how it's accomplished.
推荐答案
似乎更近的支持包的版本(因为版本5)的页面之间的空间也增加了支持 ViewPager
通过 setPageMargin()
和 setPageMarginDrawable()
。
It seems that more recent releases of the support package (since revision 5) have added support for margins between pages of ViewPager
via setPageMargin()
and setPageMarginDrawable()
.
这篇关于如何同时保持页面全宽度设置ViewPager页面之间的填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!