m4coding / Orientation-ViewPager

能够设置水平方向滚动和垂直方向滚动的ViewPager(A ViewPager that can be set horizontal orientation or vertical orientation)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Orientation-ViewPager

能够设置水平方向滚动、垂直方向滚动、滚动时间和滚动插值器的ViewPager(A ViewPager that can be set horizontal orientation or vertical orientation)

例子效果图

//Horizontal ViewPager

//Vertical ViewPager

引入

compile 'com.mcs.development:orientation-viewpager:1.0.0'

使用

<!--Horizontal ViewPager-->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.mcs.viewpager.OrientationViewPager
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/view_pager"
		app:orientation="horizontal">
    </com.mcs.viewpager.OrientationViewPager>
</LinearLayout>


<!--Vertical ViewPager-->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.mcs.viewpager.OrientationViewPager
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/view_pager"
		app:orientation="vertical">
    </com.mcs.viewpager.OrientationViewPager>
</LinearLayout>


//设置滚动时间
mViewPager.setScrollDuration(50);//50ms

//设置滚动插值器interpolator
mViewPager.setScrollInterpolator(new LinearInterpolator());//线性插值器

About

能够设置水平方向滚动和垂直方向滚动的ViewPager(A ViewPager that can be set horizontal orientation or vertical orientation)

License:Apache License 2.0


Languages

Language:Java 100.0%