Viseuse de marge
int pagerPaddingVertical = Tools.dpToPx(SubscriptionActivity.this, 32);
int pagerPaddingHorizontal = Tools.dpToPx(SubscriptionActivity.this, 32);
int margin = Tools.dpToPx(SubscriptionActivity.this, 20);
priceSlider.setClipToPadding(false);
priceSlider.setPageMargin(margin);
priceSlider.setPadding(pagerPaddingVertical, pagerPaddingHorizontal, pagerPaddingVertical, pagerPaddingHorizontal);
// Convert dp to px
public class Tools {
public static int dpToPx(Context c, int dp) {
Resources r = c.getResources();
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics()));
}
}
</ProgAli>