Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.

Overview

Android ViewPagerIndicator

Paging indicator widgets that are compatible with the ViewPager from the Android Support Library to improve discoverability of content.

Try out the sample application on the Android Market.

ViewPagerIndicator Sample Screenshots

These widgets can also be used in conjunction with ActionBarSherlock!

Usage

For a working implementation of this project see the sample/ folder.

  1. Include one of the widgets in your view. This should usually be placed adjacent to the ViewPager it represents.

    <com.viewpagerindicator.TitlePageIndicator android:id="@+id/titles" android:layout_height="wrap_content" android:layout_width="fill_parent" />

  2. In your onCreate method (or onCreateView for a fragment), bind the indicator to the ViewPager.

    //Set the pager with an adapter
    ViewPager pager = (ViewPager)findViewById(R.id.pager);
    pager.setAdapter(new TestAdapter(getSupportFragmentManager()));
    
    //Bind the title indicator to the adapter
    TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.titles);
    titleIndicator.setViewPager(pager);
    
  3. (Optional) If you use an OnPageChangeListener with your view pager you should set it in the indicator rather than on the pager directly.

    //continued from above
    titleIndicator.setOnPageChangeListener(mPageChangeListener);
    

Theming

There are three ways to style the look of the indicators.

  1. Theme XML. An attribute for each type of indicator is provided in which you can specify a custom style.
  2. Layout XML. Through the use of a custom namespace you can include any desired styles.
  3. Object methods. Both styles have getters and setters for each style attribute which can be changed at any point.

Each indicator has a demo which creates the same look using each of these methods.

Including In Your Project

Android-ViewPagerIndicator is presented as an Android library project. A standalone JAR is not possible due to the theming capabilities offered by the indicator widgets.

You can include this project by referencing it as a library project in Eclipse or ant.

If you are a Maven user you can easily include the library by specifying it as a dependency:

<dependency>
  <groupId>com.viewpagerindicator</groupId>
  <artifactId>library</artifactId>
  <version>2.4.1</version>
  <type>apklib</type>
</dependency>

This project depends on the ViewPager class which is available in the Android Support Library or ActionBarSherlock. Details for including one of those libraries is available on their respecitve web sites.

Developed By

Credits

License

Copyright 2012 Jake Wharton
Copyright 2011 Patrik Åkerfeldt
Copyright 2011 Francisco Figueiredo Jr.

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.
Comments
  • New feature: TitleBarIndicator can now split titles around their center

    New feature: TitleBarIndicator can now split titles around their center

    New attribute clipToCenter[BOOL] makes titles in TitlePageIndicator split around their center point.

    This is useful if you don't know in advance how long your page labels are going to be, or if you have long titles that constantly bump into one another.

    First commit contains all the feature changes. The second commit contains a code refactoring, since I found onDraw was barely legible anymore.

    Tested on Nexus One and Galaxy Nexus.

    I couldn't add a sample Activity, since the sample app doesn't compile for me. I think I opened an issue for that already.

    opened by mttkay 14
  • Creating Indicator from Fragment won't work

    Creating Indicator from Fragment won't work

    Hi there,

    I've included the indicator on Eclipse as library, all classes are resolved by compile time. But if I try to initialize an indicator, I receive this kind of exception

    11-13 21:57:14.230: E/AndroidRuntime(6596): java.lang.NoClassDefFoundError:com.viewpagerindicator.R$attr
    11-13 21:57:14.230: E/AndroidRuntime(6596):     at com.viewpagerindicator.CirclePageIndicator.<init>(CirclePageIndicator.java:72)
    11-13 21:57:14.230: E/AndroidRuntime(6596):     at com.viewpagerindicator.CirclePageIndicator.<init>(CirclePageIndicator.java:68)
    

    I've cleaned the project several times, tried to init the indicator programmatically all always end in this exception.

    I'm using the latest support-lib version, target SDK ist 16.

    Maybe this is important too:

    11-13 22:16:18.850: W/dalvikvm(10440): VFY: unable to resolve static field 1555 (vpiCirclePageIndicatorStyle) in Lcom/viewpagerindicator/R$attr;
    
    opened by onigunn 13
  • Rare NullPointerException via TitlePageIndicator.onTouchEvent

    Rare NullPointerException via TitlePageIndicator.onTouchEvent

    Hi, been using ViewPagerIndicator for a couple of months now in my app. But noticed a sprinkling of these errors reported via acra:

    java.lang.NullPointerException at android.support.v4.view.ViewPager.a(SourceFile:1733) at com.viewpagerindicator.TitlePageIndicator.onTouchEvent(SourceFile:496) at android.view.View.dispatchTouchEvent(View.java:4688)

    I'm using v2.2.2. Only reported on one device "PantechP4100" running 3.2.1(13)

    TitlePageIndicator:

    public boolean onTouchEvent(android.view.MotionEvent ev) {
        if ((mViewPager == null) || (mViewPager.getAdapter().getCount() == 0)) {
            return false;
        }
    
        final int action = ev.getAction();
    
        switch (action & MotionEventCompat.ACTION_MASK) {
            case MotionEvent.ACTION_DOWN:
                mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
                mLastMotionX = ev.getX();
                break;
    
            case MotionEvent.ACTION_MOVE: {
                final int activePointerIndex = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
                final float x = MotionEventCompat.getX(ev, activePointerIndex);
                final float deltaX = x - mLastMotionX;
    
                if (!mIsDragging) {
                    if (Math.abs(deltaX) > mTouchSlop) {
                        mIsDragging = true;
                    }
                }
    
                if (mIsDragging) {
                    if (!mViewPager.isFakeDragging()) {
                        mViewPager.beginFakeDrag();
                    }
    
                    mLastMotionX = x;
    
                    mViewPager.fakeDragBy(deltaX);    <---- EXCEPTION BUBBLES HERE
                }
    
                break;
            }
    

    ViewPager:

    public void fakeDragBy(float xOffset) {
        if (!mFakeDragging) {
            throw new IllegalStateException("No fake drag in progress. Call beginFakeDrag first.");
        }
    
        mLastMotionX += xOffset;
        float scrollX = getScrollX() - xOffset;
        final int width = getWidth();
        final int widthWithMargin = width + mPageMargin;
    
        final float leftBound = Math.max(0, (mCurItem - 1) * widthWithMargin);
        final float rightBound =
                Math.min(mCurItem + 1, mAdapter.getCount() - 1) * widthWithMargin;
        if (scrollX < leftBound) {
            scrollX = leftBound;
        } else if (scrollX > rightBound) {
            scrollX = rightBound;
        }
        // Don't lose the rounded component
        mLastMotionX += scrollX - (int) scrollX;
        scrollTo((int) scrollX, getScrollY());
        pageScrolled((int) scrollX);
    
        // Synthesize an event for the VelocityTracker.
        final long time = SystemClock.uptimeMillis();
        final MotionEvent ev = MotionEvent.obtain(mFakeDragBeginTime, time, MotionEvent.ACTION_MOVE,
                mLastMotionX, 0, 0);
        mVelocityTracker.addMovement(ev);     <--- EXCEPTION HERE
        ev.recycle();
    }
    

    Looks like mVelocityTracker hasn't been initialised. I'm guessing this is a bit of a freaky scenario to trigger that as the ViewPager and ViewPagerIndiciator seem to be a very resilient and happy partnership.

    Let me know if I can help further..?

    opened by howardb173 12
  • Multiple TabPagerIndicators with multiple styles

    Multiple TabPagerIndicators with multiple styles

    I have a couple of TabPagerIndicators that are in the same activity that I want to style differently. However, I can't seem to apply inline styles to them (probably because the actual widget pulls from ?attr).

    If there is a proper way to do this, then I'm asking for help (I searched a bit for a forum to do so but didnt find it here nor on the site) and if there isn't than I guess this is a feature request?

    opened by navarr 10
  • Implement better text rendering for the titles

    Implement better text rendering for the titles

    As soon as I tried ViewPagerIndicator on my app, I noticed the title text rendering didn't look that great. I looked into the code to understand how the titles were being drawn and what could I do about it. They are being rendered on a Canvas using the Paint object.

    There's nothing more it can be done about it, anti-aliasing is already enabled on the Paint object. The only thing it could be done is to change this:

    mPaintText = new Paint();
    

    Into this:

    mPaintText = new Paint(Paint.LINEAR_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    

    And also remove mPaintText.setAntiAlias(true);, but this does not give a better solution. Instead, we get a "different" solution. The rendering is just different. If it's better or worse, it really depends on the eye of the beholder.

    If you don't know, the meaning of LINEAR_TEXT_FLAG, in the words of Android Developer Roman Guy, is this:

    "Text rendering uses a font cache containing bitmap representations of each glyph the application needs. Linear text basically lets you skip the font cache."

    So, my suggestion is this:

    Get rid of the Paint object and use TextViews instead for each title. The TextView rendering is much better, here's an example on my app's implementation of the ViewPagerIndicator:

    I understand that this requires a big rewrite to the code, but in the end, the rendering will look much better and more consistent with the rest of the UI.

    opened by rfgamaral 10
  • Support v4 version being used causes issues

    Support v4 version being used causes issues

    Hey Jake,

    Since you're referencing the v4 r7 lib on central, it's causing me a huge headache trying to build with the latest v4 version using the maven android sdk deployer. There's some stuff I really need to use in the latest version. What do I have to do, fork and just work off of a different version in my branch?

    opened by christopherperry 9
  • Crash when switching between higher level fragments

    Crash when switching between higher level fragments

    Right now for debug I have a TabPageIndicator with a ViewFragment that pulls five of the same fragment. That fragment has on it a CirclePageIndicator with a ViewPager enclosed in a self-made view along with a TabPageIndicator and another ViewPager enclosed in a self-made view.

    Switching from the first page -> second page -> first page works fine. Switching from first page -> last page -> first page crashes.

    So it probably has something to do with it leaving memory. When it tries to load back in this happens:

    05-10 17:05:44.361: E/AndroidRuntime(16954): FATAL EXCEPTION: main 05-10 17:05:44.361: E/AndroidRuntime(16954): java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to com.viewpagerindicator.CirclePageIndicator$SavedState 05-10 17:05:44.361: E/AndroidRuntime(16954): at com.viewpagerindicator.CirclePageIndicator.onRestoreInstanceState(CirclePageIndicator.java:514) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.view.View.dispatchRestoreInstanceState(View.java:9876) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2330) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2330) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2330) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.view.View.restoreHierarchyState(View.java:9854) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.app.Fragment.restoreViewState(Fragment.java:407) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:897) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1080) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:431) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:160) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.view.ViewPager.populate(ViewPager.java:804) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:433) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:405) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:386) 05-10 17:05:44.361: E/AndroidRuntime(16954): at com.viewpagerindicator.TabPageIndicator$1.onClick(TabPageIndicator.java:41) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.view.View.performClick(View.java:3480) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.view.View$PerformClick.run(View.java:13983) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.os.Handler.handleCallback(Handler.java:605) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.os.Handler.dispatchMessage(Handler.java:92) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.os.Looper.loop(Looper.java:137) 05-10 17:05:44.361: E/AndroidRuntime(16954): at android.app.ActivityThread.main(ActivityThread.java:4340) 05-10 17:05:44.361: E/AndroidRuntime(16954): at java.lang.reflect.Method.invokeNative(Native Method) 05-10 17:05:44.361: E/AndroidRuntime(16954): at java.lang.reflect.Method.invoke(Method.java:511) 05-10 17:05:44.361: E/AndroidRuntime(16954): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 05-10 17:05:44.361: E/AndroidRuntime(16954): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 05-10 17:05:44.361: E/AndroidRuntime(16954): at dalvik.system.NativeStart.main(Native Method)

    opened by navarr 8
  • Add new revision of the support library to the VPI project

    Add new revision of the support library to the VPI project

    The new ADT 17 has been released and with that came a new revision of the support library. Though this doesn't have any advantage on VPI it does help others who use VPI and need the extra stuff in the new revision.

    Including VPI in our projects also includes the support library attached to the VPI project and we cannot include the new support library revision in our projects because that will conflict with the one in VPI.

    Yes we can replace the one in VPI but will give us conflicts when pulling new commits if the support library is not updated in the repo.

    opened by rfgamaral 8
  • "compatibility-v4-r4.jar" is missing

    Hi, Today I imported your Library in Eclipse but evertime I try to build the sample. I got this error:

    The container 'Maven Dependencies' references non existing library 'C:\Users\Cracksoldier.m2\repository\android\support\compatibility-v4\r4\compatibility-v4-r4.jar'

    I already checked this folder and it only contains the two following files:

    compatibility-v4-r4.jar.lastUpdated compatibility-v4-r4.pom.lastUpdated

    Maven and the plugin is installed and works right. This the output of the Eclipse Console during the import of your git repo:

    20.12.11 21:49:44 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml. 20.12.11 21:49:45 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [INFO] Using NULL lifecycle mapping for MavenProject: com.viewpagerindicator:parent:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\pom.xml. 20.12.11 21:49:45 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:sample:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\sample\pom.xml. 20.12.11 21:49:45 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml. 20.12.11 21:49:45 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:sample:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\sample\pom.xml. 20.12.11 21:49:45 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available 20.12.11 21:49:45 MEZ: [INFO] Adding source folder /library/src 20.12.11 21:49:45 MEZ: [INFO] Adding source folder /sample/src 20.12.11 21:49:45 MEZ: [INFO] Adding source folder /sample/src 20.12.11 21:49:45 MEZ: [INFO] Project import completed 17 sec 20.12.11 21:49:47 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available 20.12.11 21:49:47 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml. 20.12.11 21:49:47 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available 20.12.11 21:49:47 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available 20.12.11 21:49:47 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available 20.12.11 21:49:47 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available 20.12.11 21:49:47 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml. 20.12.11 21:49:47 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available 20.12.11 21:49:47 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available 20.12.11 21:49:47 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:sample:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\sample\pom.xml. 20.12.11 22:12:32 MEZ: [INFO] Updated index for repository: central|http://repo1.maven.org/maven2 in 1511023 ms 20.12.11 22:15:59 MEZ: [WARN] The POM for com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.0.0-alpha-10 is missing, no dependency information available 20.12.11 22:16:00 MEZ: [INFO] Using DEFAULT lifecycle mapping for MavenProject: com.viewpagerindicator:library:2.2.0 @ C:\Users\Cracksoldier\Workspace\parent\library\pom.xml. 20.12.11 22:16:00 MEZ: [WARN] The POM for android:android:jar:1.6_r3 is missing, no dependency information available 20.12.11 22:16:00 MEZ: [WARN] The POM for android.support:compatibility-v4:jar:r4 is missing, no dependency information available

    Where can I get this file. I already googled it but I couldnt find it yet. I hope someone can help me.

    Best Regards Cracksoldier

    Fixed-Not-Released Bug Report 
    opened by ghost 8
  • Persistent Exception onResume

    Persistent Exception onResume

    I implemented your library in my project. However now I am getting many bug reports, having to do with the TitlePageIndicator.java code. Specifically here is part of the exception

    java.lang.IndexOutOfBoundsException: Invalid index 3, size is 1
    at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257)
    at java.util.ArrayList.get(ArrayList.java:311)
    at com.jakewharton.android.viewpagerindicator.TitlePageIndicator.onDraw(TitlePageIndicator.java:304)
    

    This seems to be occurring onResume but not if the activity is resumed right away, only if some time passes. Hoping you could shed some light on this issue.

    opened by leowhiterussian 8
  • Styled/Themed underline page indicator in non functional

    Styled/Themed underline page indicator in non functional

    If you style or theme the underline indicator through layout or theme, the first indicator item fills the entire page. The issue exists on the demos as well.

    Screenshot: https://docs.google.com/open?id=0B4UIKIiIblQrb3FmSmViWWxtWlE

    opened by akshaydashrath 7
  • NullPointerException, call beginFakeDrag before fakeDragBy

    NullPointerException, call beginFakeDrag before fakeDragBy

    https://github.com/JakeWharton/ViewPagerIndicator/blob/8cd549f23f3d20ff920e19a2345c54983f65e26b/library/src/com/viewpagerindicator/CirclePageIndicator.java#L309

    java.lang.NullPointerException:   Attempt to invoke virtual method 'void   android.view.VelocityTracker.addMovement(android.view.MotionEvent)' on a null   object reference\n\tat   android.support.v4.view.ViewPager.fakeDragBy(SourceFile:2644)\n\tat   com.xxx.xxx.ui.widget.aj.onTouchEvent(SourceFile:296)\n\tat   android.view.View.dispatchTouchEvent(View.java:9414)\n\tat   
    
    opened by Logan676 0
  • java.lang.NullPointerException

    java.lang.NullPointerException

    I am facing this issue for a long time at Google Play Console. The stack trace is: java.lang.NullPointerException: at android.support.v4.view.ViewPager.endFakeDrag (ViewPager.java:2577) at com.viewpagerindicator.TitlePageIndicator.onTouchEvent (TitlePageIndicator.java:581) at android.view.View.dispatchTouchEvent (View.java:10018) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2876) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2519) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2844) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2519) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2844) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2519) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2844) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2519) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2844) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2519) at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2844) at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2519) at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent (PhoneWindow.java:2869) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1861) at android.app.Activity.dispatchTouchEvent (Activity.java:3061) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:71) at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent (PhoneWindow.java:2830) at android.view.View.dispatchPointerEvent (View.java:10253) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:5529) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:5365) at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4810) at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4863) at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4829) at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4970) at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4837) at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:5027) at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4810) at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4863) at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4829) at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4837) at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4810) at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:7531) at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:7399) at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:7360) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:7641) at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce (MessageQueue.java) at android.os.MessageQueue.next (MessageQueue.java:323) at android.os.Looper.loop (Looper.java:135) at android.app.ActivityThread.main (ActivityThread.java:7406) at java.lang.reflect.Method.invoke (Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

    Is there any solution to avoid this crash?

    opened by chwakil 2
  • Crash when using color values from styles.

    Crash when using color values from styles.

    I'm trying to set colors like that:

    app:fillColor="?attr/colorAccent"
    app:pageColor="?attr/colorPrimary"
    app:strokeColor="?attr/colorPrimary"
    

    It worked before, but now it throws:

    android.view.InflateException: Binary XML file line #16: Binary XML file line #17: Error inflating class com.viewpagerindicator.CirclePageIndicator caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1d

    I've tried to set @color/color_primary values and '#ff00ff' color hex values: the same issue.

    As a workaround: I set all needed colors in runtime by calling setFillColor(), setPageColor() and setStrokeColor() respectively.

    minSdkVersion 21
    targetSdkVersion 26
    buildToolsVersion "26.0.0"
    
    opened by dmitvitalii 15
Android auto scroll viewpager or viewpager in viewpager

Android Auto Scroll ViewPager ViewPager which can auto scrolling, cycling, decelerating. ViewPager which can be slided normal in parent ViewPager. Att

Trinea 1.7k Dec 10, 2022
Pixplicity 915 Nov 8, 2022
Don't write a ViewPager Adapter! Hook up your ViewPager to your data model using Android Data Binding Framework. With Kotlin support!

Don't write a ViewPager Adapter! Hook up your ViewPager to your data model using Android Data Binding Framework. Show some ❤️ ?? Sweet and short libra

Rakshak R.Hegde 180 Nov 18, 2022
Android - A ViewPager page indicator that displays the current page number and (optionally) the page count

NumericPageIndicator A ViewPager page indicator that displays the current page number and (optionally) the page count. It can also display buttons to

Manuel Peinado Gallego 253 Nov 16, 2022
An interactive indicator to navigate between the different pages of a ViewPager

Android PagerSlidingTabStrip (default Material Design) This library is not maintained anymore and there will be no further releases. For most of the c

JPARDOGO 2.2k Jan 4, 2023
Pager (especially for ViewPager) indicator in two styles: circle & fraction.

PagerIndicator Pager (especially for ViewPager) indicator in two styles: circle & fraction. Demo circle fraction Dependency implementation 'me.liangfe

Fei Liang 212 Nov 28, 2022
Pager (especially for ViewPager) indicator in two styles: circle & fraction.

PagerIndicator Pager (especially for ViewPager) indicator in two styles: circle & fraction. Demo circle fraction Dependency implementation 'me.liangfe

Fei Liang 212 Nov 28, 2022
UltraViewPager is an extension for ViewPager to provide multiple features in a single ViewPager.

UltraViewPager 中文文档 ProjectUltraViewPager is a ViewPager extension that encapsulates multiple features, mainly to provide a unified solution for multi

Alibaba 5k Dec 20, 2022
Persons cards list viewpager - Persons cards list viewpager using kotlin

persons_cards_list_viewpager Дизайн и условие взяты из https://github.com/appKOD

Mironov Ury 1 Mar 1, 2022
A simple app that consumes The Ricky & Morty API to display the tv show characters, was trying to learn about pagination with the paging 3 library

Ricky&MortyAPIDemo A simple app that consumes The Rick and Morty API which is a REST and GraphQL API based on the television show Rick and Morty. I wa

Joel Kanyi 9 Jul 12, 2022
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.

ViewPagerTransforms Library containing common animations needed for transforming ViewPager scrolling on Android v13+. This library is a rewrite of the

Ian Thomas 2.5k Dec 31, 2022
A Material Design ViewPager easy to use library

MaterialViewPager Material Design ViewPager easy to use library Sample And have a look on a sample Youtube Video : Youtube Link Download In your modul

Florent CHAMPIGNY 8.2k Dec 29, 2022
LiquidSwipe is a ViewPager library that can be used to make Awesome Onboarding designs.

LiquidSwipe LiquidSwipe is a ViewPager library that can be used to make Awesome Onboarding designs. Usage Set up the dependency Add the mavenCentral()

Farham Hosseini 4 Nov 5, 2021
Circular motion is a ViewPager library that can be used to make Awesome Onboarding designs.

CircularMotion Android Circular Motion Onboarding library Circular motion is a ViewPager library that can be used to make Awesome Onboarding designs.

Farham Hosseini 4 Nov 5, 2021
[Development stopped in 2014. Unfinished and not stable - not recommended to use.] An easy-to-use ViewPager subclass with parallax background effect for Android apps.

Development stopped in 2014 Not developed since 2014. Unfinished and not stable - not recommended to use. ParallaxViewPager An easy-to-use ViewPager s

Andras Kindler 437 Dec 29, 2022
Combine ViewPager and Animations to provide a simple way to create applications' guide pages.

WoWoViewPager WoWoViewPager combines ViewPager and Animations to provide a simple way to create applications' guide pages. When users are dragging WoW

黄伟平 2.7k Dec 30, 2022
An android ViewPager extension allowing infinite scrolling

NO LONGER MAINTAINED LoopingViewPager An android ViewPager extension allowing infinite scrolling. You can use it with "standart" PagerAdapter (inflati

Leszek Mzyk 992 Nov 10, 2022
Augment Android's ViewPager with wrap-around functionality.

Infinite View Pager Augment Android's ViewPager with wrap-around functionality. Original StackOverflow question: http://stackoverflow.com/questions/75

Antony Tran 692 Dec 14, 2022
Android ViewPager template with cool animation.

glazy-viewpager ViewPager template with cool animation. Preview Dependencies compile 'com.android.support:palette-v7:25.2.0' Usage Refer the implement

Kannan Anbarasan 251 Nov 29, 2022