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.
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...
The new Android Market does this the way I'd like, but I just can't figure out how it's accomplished.
There's currently no way to do that in the XML layout, but you can use the following functions in java:
setPageMargin(int marginPixels)
setPageMarginDrawable(drawable d)
setPageMarginDrawable(int resId)
You'll need to grab the pager from your XML layout first:
ViewPager pager = (ViewPager) findViewById(R.id.pager);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With