This is an example of my activity with element fixed and automatic margin:
But when use fragment:
Its possibile to set margin on fragment?
In the fragment container in your activity xml, set padding to the container. In your specific case, set it to the ViewPager.