ViewPager - 获取下一个页面的局部视图 [英] ViewPager - get a partial view of the next page

查看:210
本文介绍了ViewPager - 获取下一个页面的局部视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ViewPager实现这一

I am trying to achieve this in a ViewPager

第一个片段(蓝色)显示,下一个片段开始时的用户了解,他可以刷卡切换视图必须显示为好,所以。 我们的想法是滚动屏幕的20%以编程到左侧。

The first fragment (blue) is displayed and the beginning of the next fragment must be displayed as well, so the user understands he can swipe to switch views. The idea is scroll 20% of the screen programmatically to the left.

有什么想法,欢迎

编辑:这正是我需要到:中央认为需要重叠两侧意见

This is exactly what I need to to: the central view needs to overlap both side views

推荐答案

您可以尝试添加到您PageAdapter:

You can try adding this to your PageAdapter:

public float getPageWidth(int position) {
    if (position == 0 || position == 2) {
        return 0.8f;
    }
    return 1f;
}

这篇关于ViewPager - 获取下一个页面的局部视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆