Reputation: 467
I have some problems with my application. I have the next activity:
This activity has a ViewPager (the rounded rectangle with the gradient colour) and I need to set margins or padding to right and left. I thought in this solution:
<ViewPager
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"/>
Doing this, but adding margin only to right, it looks like:
But this is a problem because I get the next results when swipping the screen:
As you can see, the fragment doesn't appears from the screen limit, but it appears from the margin I set to ViewPager.
What I need is to have the ViewPager filling the parent horizontally but with the rounded rectangle limited by right and left due to some kind of margin.
I have already tried to set the margin directly to the fragment's XML code but it doesn't reflects any effect.
Hope you can help me.
Upvotes: 1
Views: 4623
Reputation: 66
I guess the layout with the rounded corners is the layout your viewpager calls, try to create a linearlayout inside your current layout and add the margins inside this one. I hope this helps you, or it may inspire you a solution.
Upvotes: 2