基于官方 ViewPager,可以竖直水平滑动的 YViewPager

YViewPagerDemo

项目地址: youngkaaa/YViewPagerDemo 
简介:基于官方 ViewPager,可以竖直水平滑动的 YViewPager
更多: 作者    提 Bug   
标签:
viewpager-

由于个人原因,该仓库停止维护

YViewPager,support horizontal and vertical,based on support.v4.view.ViewPager

中文版点这里

Usage

Gradle

compile 'cn.youngkaaa:yviewpager:0.4'

Maven

<dependency>
  <groupId>cn.youngkaaa</groupId>
  <artifactId>yviewpager</artifactId>
  <version>0.4</version>
  <type>pom</type>
</dependency>

Intro

The YViewPager is modified from the official support.v4.view.ViewPager,which support the direction of horizontal and vertical(new direction).You can use this lib just like the official support.v4.view.ViewPager,include the features of setPageTransformer()addOnPageChangeListener()setOffscreenPageLimit() and so on,And also supported the TabLayout.

Feature

Direction

On the base of the support.v4.view.ViewPager,add the property of direction. You can use it by:

xml
<cn.youngkaaa.yviewpager.YViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:orientation="vertical"/>

just like the above xml.you can add the property app:orientation in YViewPager tag, the value of this property is horizontal and vertical.

java code
mViewPager.setDirection(YViewPager.VERTICAL);

mViewPager.setDirection(YViewPager.HORIZONTAL);

you can change the direction by calling the YViewPager.setDirection()

Tip:It's not recommended that change the direction when your application is running,which include a inflated YViewPager,because at this time the YViewPager may included the Fragments,which may has the deeply view hierarchy,and when you call the setDriection() may invaliate the layout,so may cause the application ANR or bad layout.but it's just not recommended,not unsupport!

Circulatory

in v1.2,add the property of circulatory.you can use it by:

xml
<cn.youngkaaa.yviewpager.YViewPager
  android:id="@+id/viewpager1"
  android:layout_width="match_parent"
  android:layout_height="188dp"
  app:circulatory="true"
  app:orientation="horizontal"/>

yeah,you just need to add one line.

java

sorry,the property of circulatory do not support to change by using java code.

Version

v0.4

see here (2017-4-18)

v0.3

minSdkVersion to 14 (2017-4-08)

v0.2

add the circulatory property,which support the direction of horizontal and vertical (2017-2-26)

v0.1

support the direction of vertical and horizontal(2017-2-22

Finally

Because the FragmentPagerAdapter 、FragmentStatePagerAdapter and PagerAdapter has some methods are not br called in YViewPager,so I copy the code in this lib named YFragmentPagerAdapterYFragmentStatePagerAdapter and YPagerAdapter,you can choose the YxxxxxAdapter in this lib which you needed!

The running screenshot:

v0.1

v0.2

If you think this lib help you,you can give me a star to encourage me! thanks a lot

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值