由于个人原因，该仓库停止维护/For personal reasons, this repository stopped maintenance
YViewPager,support horizontal and vertical,based on
<dependency> <groupId>cn.youngkaaa</groupId> <artifactId>yviewpager</artifactId> <version>0.4</version> <type>pom</type> </dependency>
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
setOffscreenPageLimit() and so on,And also supported the
On the base of the
support.v4.view.ViewPager,add the property of
direction. You can use it by：
<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
YViewPager tag, the value of this property is
you can change the direction by calling the
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!
v1.2,add the property of
circulatory.you can use it by:
<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.
sorry,the property of
circulatory do not support to change by using java code.
see here (
minSdkVersion to 14 (
circulatory property，which support the direction of horizontal and vertical (
support the direction of vertical and horizontal（
PagerAdapter has some methods are not br called in
YViewPager，so I copy the code in this lib named
YPagerAdapter，you can choose the
YxxxxxAdapter in this lib which you needed!
The running screenshot：
If you think this lib help you,you can give me a star to encourage me! thanks a lot
Copyright 2017 youngkaaa Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.