The android.support.v4.view.ViewPager is a library package that provides a convenient way to implement swipe views in your android app. The setPageMargin method is used to set the margin between pages in a ViewPager.
Example 1: ViewPager viewPager = findViewById(R.id.view_pager); viewPager.setPageMargin(20);
In this example, we are setting the margin between pages in the ViewPager to be 20 pixels.
Example 2: ViewPager viewPager = findViewById(R.id.view_pager); viewPager.setPageMarginResource(R.dimen.page_margin);
In this example, we are setting the margin between pages in the ViewPager to be a value defined in the resources file. This is useful when you want to define the margin in one place and use it throughout your app.
Package library: android.support.v4.view
Java ViewPager.setPageMargin - 30 examples found. These are the top rated real world Java examples of android.support.v4.view.ViewPager.setPageMargin extracted from open source projects. You can rate examples to help us improve the quality of examples.