Name: UltraViewPager
Owner: Alibaba
Description: UltraViewPager is an extension for ViewPager to provide multiple features in a single ViewPager.
Created: 2017-03-29 13:31:53.0
Updated: 2018-05-24 09:50:06.0
Pushed: 2018-05-02 07:11:24.0
Homepage: null
Size: 8883
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
ProjectUltraViewPager
is a ViewPager extension that encapsulates multiple features, mainly to provide a unified solution for multi-page switching scenarios.
you can combine multiple features at the same time.
UltraViewPager is a super extension for ViewPager. It's actually a RelativeLayout in order to display ViewPager and Indicator.UltraViewPager offers some common method delegate for ViewPager, you can also invoke more method by call getViewPager() and get the actual ViewPager.
In order to achieve vertical scroll, through exchanging MotionEvent in onInterceptTouchEvent and onTouchEvent.For more details, you can read the source code.
Please find the latest version(1.0.7.7 so far) in maven repository. The newest version has been upload to jcenter and MavenCantral, make sure you have added at least one of these repositories.
Using Gradle:
adle
ile ('com.alibaba.android:ultraviewpager:1.0.7.7@aar') {
transitive = true
or grab via Maven:
m.xml in maven
endency>
roupId>com.alibaba.android</groupId>
rtifactId>ultraviewpager</artifactId>
ersion>1.0.7.7</version>
ype>aar</type>
pendency>
Create your own layout using a UltraViewPager:
activity_pager.xml
.tmall.ultraviewpager.UltraViewPager
android:id="@+id/ultra_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/darker_gray" />
You can follow my tutorial below on how to use UltraViewPager:
aViewPager ultraViewPager = (UltraViewPager)findViewById(R.id.ultra_viewpager);
aViewPager.setScrollMode(UltraViewPager.ScrollMode.HORIZONTAL);
itialize UltraPagerAdapter?and add child view to UltraViewPager
rAdapter adapter = new UltraPagerAdapter(false);
aViewPager.setAdapter(adapter);
itialize built-in indicator
aViewPager.initIndicator();
t style of indicators
aViewPager.getIndicator()
.setOrientation(UltraViewPager.Orientation.HORIZONTAL)
.setFocusColor(Color.GREEN)
.setNormalColor(Color.WHITE)
.setRadius((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()));
t the alignment
aViewPager.getIndicator().setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
nstruct built-in indicator, and add it to UltraViewPager
aViewPager.getIndicator().build();
t an infinite loop
aViewPager.setInfiniteLoop(true);
able auto-scroll mode
aViewPager.setAutoScroll(2000);
For other API reference,see this to read more.
Before you open an issue or create a pull request, please read Contributing Guide first.
UltraViewPager
is available under the MIT license.