Swipe half page in a ViewPager (from compatibility pack)

允我心安 提交于 2019-11-28 21:59:46
  1. Create one fragment per page
  2. Override getPageWidth() in PageAdapter to display more than one page

Code:

@Override
public float getPageWidth(int position) {
    float nbPages = 2; // You could display partial pages using a float value
    return (1 / nbPages);
}

Yes, use the child width as half the page. Therefore, the swiping, which calls next child, will swipe half the page. Good Luck!

Edit: Checked your sketch again, try implementing 1st, 2nd, 3rd... as different childs. (I predict most of the solution while assuming it will react as GalleryView)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!