android - Make all ViewPager item center-aligned when PagerAdapter.getPageWidth() < 1f -
issue description: when pageradapter.getpagewidth() < 1f, item shows @ left side.
my question want item @ center or right side. when scrolling left or right, items center-alignment. (viewpager width = page width + 2*pagemargin)
you can translate canvas in drawchild method,like
@override protected boolean drawchild(canvas canvas, view child, long drawingtime) { canvas.save(); canvas.translate(distance, 0); // change distance value want boolean r = super.drawchild(canvas, child, drawingtime); canvas.restore(); return r; }
Comments
Post a Comment