ViewPager - get a partial view of the next page(ViewPager - 获取下一页的部分视图)
本文介绍了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 - 获取下一页的部分视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
织梦狗教程
本文标题为:ViewPager - 获取下一页的部分视图
基础教程推荐
猜你喜欢
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
