Align the child views in center of the ViewPager android

前端 未结 7 1060
Happy的楠姐
Happy的楠姐 2020-12-09 17:11

I need to set the child view as center of the ViewPager and also I would like to show some part of the next and previous views to the current view sides(like current screen

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 17:35

    For anyone upset that the OP didn't update his question with the solution here is a link that explains, with minimal effort, how to pull this off in XML: http://blog.neteril.org/blog/2013/10/14/android-tip-viewpager-with-protruding-children/

    Basically when you declare your viewpager in XML, give it the same left and right padding and set android:clipToPadding="false". (The clipToPadding is missing in his xml sample and necessary to achieve this effect)

提交回复
热议问题