ongakuer / circleindicator Goto Github PK
View Code? Open in Web Editor NEWA lightweight indicator like in nexus 5 launcher
License: Apache License 2.0
A lightweight indicator like in nexus 5 launcher
License: Apache License 2.0
how i resize the circle larger than before, i had tried using app:ci_height or width but it doesn't work
thank you
as titled
Hello there, can you help me change the color of current indicator?
12-17 09:50:04.638 12608-12608/? A/MobUncaughtExceptionHandler: null
java.lang.NullPointerException
at android.animation.AnimatorSet$AnimatorSetListener.onAnimationEnd(AnimatorSet.java:744)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1012)
at android.animation.ValueAnimator.access$400(ValueAnimator.java:51)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:623)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:639)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:531)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
12-17 09:50:04.646 12608-12608/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException
at android.animation.AnimatorSet$AnimatorSetListener.onAnimationEnd(AnimatorSet.java:744)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1012)
at android.animation.ValueAnimator.access$400(ValueAnimator.java:51)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:623)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:639)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:531)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
If I have setup a view pager and added this lib.
then if runtime there is one page added or one item is deleted. this doesn't update.
What i have done is
when my pager is updated. I have call the method
createIndicators(View Pager);
this create a new list of pagerindicator it is OK. but the value/progress doesn't remain.
for this i have to call method setProgress(viewpager.getCurrentIndex());
This will move the the currenct page indicator to the right position.but in this situation there are two current page indicator on the screen first is on index one. and other one is on the right positoin.
There is need to add a observer with adapter or viewpager with this library.
hope you understand the issue.
Creating a CircleIndicator
without an AttributeSet
does not properly set the width, height, and margin of the indicators:
CircleIndicator indicator = new CircleIndicator(getActivity());
Because handleTypedArray()
only sets default values when mIndicatorWidth
/mIndicatorHeight
/mIndicatorMargin < 0
but they're not set in any constructor.
Thanks for your Project.
I think it's better add Usage setViewPager
Thanks :)
CircleIndicator indicator = (CircleIndicator)findViewById(R.id.indicator);
mViewPager.setAdapter(mPageAdapter);
indicator.setViewPager(mViewPager);
Hello I can compile the project without any problems, however, when I run the application it directly crashes and gives the following exception on Android 4.2 devices.
Btw android 5.0 and above devices works perfectly.
Do you have any idea how to which this issue?
Caused by: java.lang.NoClassDefFoundError: me.relex.circleindicator.R$animator
at me.relex.circleindicator.CircleIndicator.(CircleIndicator.java:25)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:594)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
Error:(15, 13) Failed to resolve: me.relex:circleindicator:1.1.6
Show in File
Show in Project Structure dialog
Problem code is here I believe. Looks like mCurrentSelectedPosition
is ignored when creating the indicators.
private void createIndicators(ViewPager viewPager) {
this.removeAllViews();
if(viewPager.getAdapter() != null) {
int count = viewPager.getAdapter().getCount();
if(count > 0) {
this.addIndicator(this.mIndicatorBackgroundResId, this.mAnimationOut);
for(int i = 1; i < count; ++i) {
this.addIndicator(this.mIndicatorUnselectedBackgroundResId, this.mAnimationIn);
}
}
}
}
viewPager.setCurrentItem(2);
circleIndicator.setViewPager(viewPager);
第0个和第2个的点都是选中状态,即使手动调用下面一句也没有用
// circleIndicator.onPageSelected(currentIndex);
As per Google guidelines, all applications should now target minSdkVersion="14"
or higher which has access to the platform animation APIs. Since NineOldAndroids idea is to make platform animations available for lower API's, it should no longer be a necessary dependency as long as you update the project to API 14.
For more information: https://github.com/JakeWharton/NineOldAndroids/
Hey man,
This is really good work but when I used it with the ParallaxViewPager (see this: https://github.com/andraskindler/parallaxviewpager ), it got rid of the background image (so basically no parallex effect). I looked at the source and saw that you're messing around with the viewpager (is that why?)
Thanks.
private final OnPageChangeListener mInternalPageChangeListener = new OnPageChangeListener() {
...
...
...
if (mLastPosition >= 0) {
View currentIndicator = getChildAt(mLastPosition);
currentIndicator.setBackgroundResource(mIndicatorUnselectedBackgroundResId);
mAnimatorIn.setTarget(currentIndicator);
mAnimatorIn.start();
}
currentIndicator could be null, if there is no last position any more(like remove view from viewpager
Hi,
I've tried to import both of ur libs as dependencies. but non of them imported.
I have this libs as my custom libs:
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
CircleIndicator.java#L182
- addIndicator(mIndicatorBackgroundResId, mAnimationOut);
- for (int i = 1; i < count; i++) {
- addIndicator(mIndicatorUnselectedBackgroundResId, mAnimationIn);
+ int currentIndicator = viewPager.getCurrentItem();
+ for (int i = 0; i < count; i++) {
+ if (i == currentIndicator) {
+ addIndicator(mIndicatorBackgroundResId, mAnimationOut);
+ }
+ else {
+ addIndicator(mIndicatorUnselectedBackgroundResId, mAnimationIn);
+ }
I have implemented a custom drawable for both selected and unselected states.
selected_dot.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/red"/>
<size android:width="10dp" android:height="10dp" />
</shape>
unslected_dot.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"/>
<size android:width="10dp" android:height="10dp" />
</shape>
As you can see in my drawable files, both dots have the same size of 10dp
, however when running the application, the unselected dots appear smaller than the selected dot.
Here is how I'm using the drawables in the CircleIndicator
:
<me.relex.circleindicator.CircleIndicator
android:id="@+id/circle_indicator"
android:layout_width="match_parent"
android:layout_height="48dp"
app:ci_drawable="@drawable/selected_dot"
app:ci_drawable_unselected="@drawable/unselected_dot" />
I have a dynamic viewpager, allowing add/remove of pages.Are there plans to adapt CircleIndicator library to handle dynamic add/remove of pages?
when i calling the class it got erorr like this :
The following classes could not be instantiated:
- me.relex.circleindicator.CircleIndicator (Open Class, Show Exception, Clear Cache)
the IDE Exception Details
java.lang.NoClassDefFoundError: me/relex/circleindicator/R$styleable at me.relex.circleindicator.CircleIndicator.handleTypedArray(CircleIndicator.java:59) at me.relex.circleindicator.CircleIndicator.init(CircleIndicator.java:50) at me.relex.circleindicator.CircleIndicator.(CircleIndicator.java:44) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:835) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:811) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:811) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:394) Copy stack to clipboard
Hello,
first of all, good work with everything. I have a lot of pages in my pageviewer (more than 60 entries) and i'm trying to implement that only 3 or 4 (or any other small number) of indicators is visible and that the selected one is in the middle and when you scroll on either side it just repeats until you reach the end. Currently if i implement the indicator, it tries to show a dot for every page in the page adapter and because i have so many they don't fit on the layout plus it looks very ugly. Any suggestions how to implement it?
java.lang.NullPointerException at
me.relex.circleindicator.CircleIndicator$1.onPageSelected(CircleIndicator.java:179)
me.relex.circleindicator.CircleIndicator.setViewPager(CircleIndicator.java:151)
At first, setViewPager with 3 items.
User selected page at 3rd, and then call setViewPager again with only 2 items.
getChildAt(mLastPosition)
will be null.
need to consider handle NullPointerException
when currentIndicator
is null.
Thanks.
After adding multiDexEnabled true in my project i am getting this error below is the complete log. And also this code is running on emulator but not on real device
02-22 18:10:25.857 6962-6962/com.development.ngh.happyhours E/dalvikvm﹕ Could not find class 'me.relex.circleindicator.CircleIndicator$ReverseInterpolator', referenced from method me.relex.circleindicator.CircleIndicator.checkIndicatorConfig 02-22 18:10:25.927 6962-6962/com.development.ngh.happyhours E/AndroidRuntime﹕ FATAL EXCEPTION: main android.view.InflateException: Binary XML file line #34: Error inflating class me.relex.circleindicator.CircleIndicator at android.view.LayoutInflater.createView(LayoutInflater.java:619) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:693) at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at com.development.ngh.happyhours.fragments.PartyFragment.onCreateView(PartyFragment.java:114) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613) at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141) at android.support.v4.view.ViewPager.populate(ViewPager.java:1106) at android.support.v4.view.ViewPager.populate(ViewPager.java:952) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1474) at android.view.View.measure(View.java:16482) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:681) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:16482) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5055) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135) at android.view.View.measure(View.java:16482) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5055) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435) at android.widget.LinearLayout.measureVertical(LinearLayout.java:720) at android.widget.LinearLayout.onMeasure(LinearLayout.java:592) at android.view.View.measure(View.java:16482) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5055) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16482) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5055) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1435) at android.widget.LinearLayout.measureVertical(LinearLayout.java:720) at android.widget.LinearLayout.onMeasure(LinearLayout.java:592) at android.view.View.measure(View.java:16482) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5055) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560) at android.view.View.measure(View.java:16482) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2195) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1340) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1551) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1237) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5162) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791) at android.view.Choreographer.doCallbacks(Choreographer.java:591) at android.view.Choreographer.doFrame(Choreographer.java:561) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5317) at java.lang.reflect.Method.invokeNat
In layout, the namespace xmlns:app="http://schemas.android.com/apk/res-auto" is defined in the root View, but the custom properties aren't found.
Throws NullPointerException when there already setViewPager, again setViewPager called.
...
PagerAdapter aAdapter = new Page4Adapter();//Page count 4.
PagerAdapter bAdapter = new Page3Adapter();//Page count 3.
ViewPager pager = find...
pager.setAdapter(aAdapter);
...
pager.setCurrentItem(3,false);
...
setViewPager(bAdapter);//<- here
...
I have modified the code.
public void setViewPager(ViewPager viewPager) {
mViewpager = viewPager;
mCurrentPosition = mViewpager.getCurrentItem();
createIndicators(viewPager);
mViewpager.setOnPageChangeListener(this);
onPageSelected(mCurrentPosition);
}
@Override public void onPageSelected(int position) {
if (mViewPagerOnPageChangeListener != null) {
mViewPagerOnPageChangeListener.onPageSelected(position);
}
if (mAnimationIn.isRunning()) mAnimationIn.cancel();
if (mAnimationOut.isRunning()) mAnimationOut.cancel();
View currentIndicator = getChildAt(mCurrentPosition);
currentIndicator.setBackgroundResource(mIndicatorUnselectedBackground);
mAnimationIn.setTarget(currentIndicator);
mAnimationIn.start();
View selectedIndicaotr = getChildAt(position);
selectedIndicaotr.setBackgroundResource(mIndicatorBackground);
mAnimationOut.setTarget(selectedIndicaotr);
mAnimationOut.start();
mCurrentPosition = position;
}
v1.2.0
Error:Attribute "orientation" has already been defined
First of all, thank you for sharing your work, this material circle indicator is really quite cool ;)
I would like to let you an issue about the selected state of the CircleIndicator with the use of a dynamic viewpager.
Despite the fact that I have to call the setViewPager() method each time I notify my adapter that the data size has changed to avoid an exception, I also have another problem which can also be bypassed by another method call.
Here is the concerned use of CircleIndicator :
mPagerAdapter.add(object); // dynamic add of an object
mPagerAdapter.notifyDataSetChanged(); // notify the data change
mPagerIndicator.setViewPager(mImagesPager); // reset the viewpager to the indicator
mViewPager.setCurrentItem(0, false); // set the current item to the first position
mViewPager.setCurrentItem(mPagerAdapter.getCount()-1, false); // set the current item to the wanted position (the last added object)
The question is : why do I set the item to the position 0 just before setting it to wanted position ?
Because it permits me to avoid the following bug : the wanted position in a selected state AND also the first one.
If I directly set the wanted position, I don't know why (for the moment, I will take time to read the CircleIndicator class) but the first indicator will always be selected.
Thanks in advance for your answer !
java.lang.IllegalStateException:
Observer me.relex.circleindicator.CircleIndicator$2@53a1573 is already registered.
at android.database.Observable.registerObserver(Observable.java:49)
at android.support.v4.view.PagerAdapter.registerDataSetObserver(PagerAdapter.java:291)
at me.relex.circleindicator.CircleIndicator.setViewPager(CircleIndicator.java:150)
I'm fairly certain I've implemented everything as required, working off the sample with defaultIndicator. But when I change pages, the dots don't change along.
I'm working within a Fragment, in onViewCreated:
CircleIndicator pagerIndicator = (CircleIndicator) view.findViewById(R.id.pager_indicator); pagerIndicator.setViewPager(pager);
I think that's all that is required besides the XML implementation in the view? Or am I missing something?
java.lang.NoSuchMethodError: android.support.v4.view.ViewPager.removeOnPageChangeListener
at me.relex.circleindicator.CircleIndicator.setViewPager(CircleIndicator.java:127)
I would like to use your code to insert a layout information in my app.
I want to know how to insert a picture with text instead of the background color thanks.
I hope I can answer :D
Thanks in advance for any response
I tried to add circleIndicator to AutoScrollViewPager,But it doesn't work.
ImagePagerAdapter imagePagerAdapter = new ImagePagerAdapter(getActivity(),arrayList).setInfiniteLoop(true);
viewPager.setAdapter(imagePagerAdapter);
defaultIndicator.setViewPager(viewPager);
Hi, Can you make this class work with api 9? I will very appreciate it.
Thanks
Haim.
My context is to use the indicator in a Dialog, that does not give access to fragment manager.
在项目中LeakCanary检测了内存泄露
使用场景:CircleIndicator搭配ViewPager作为RecyclerView的一个Item
In com.qingsongchou.social:1.0.3:1.
It seems the code is trying to access non-existing methods on ViewPager
java.lang.NoSuchMethodError: android.support.v4.view.ViewPager.removeOnPageChangeListener
at me.relex.circleindicator.CircleIndicator.setViewPager(CircleIndicator.java:127)
Hi, first of all, great work.
Is there any way to "deactivate" the first circle?, when I set the setCurrentItem in the adapter, the circle on that position is well activated but also the first one.
Regards.
I tried to use with https://github.com/imbryk/LoopingViewPager. But, it crash when viewpager current item is on last child, and try to looping to 1st child.
This is error I received :
E/MessageQueue-JNI: java.lang.NullPointerException
at me.relex.circleindicator.CircleIndicator$1.onPageSelected(CircleIndicator.java:185)
at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1794)
at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:569)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:553)
at android.support.v4.view.ViewPager.onTouchEvent(ViewPager.java:2102)
at android.view.View.dispatchTouchEvent(View.java:7690)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2210)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1945)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2066)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1515)
at android.app.Activity.dispatchTouchEvent(Activity.java:2457)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2014)
at android.view.View.dispatchPointerEvent(View.java:7870)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3919)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3808)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3406)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3456)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3425)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3510)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3433)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3567)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3406)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3456)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3425)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3433)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3406)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5520)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5500)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5471)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java
i have these setups for
compile 'com.android.support:support-v13:22.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setBackgroundResource(int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5401)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:725)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
Hello! I tried to use your CircleIndicator class with this library https://github.com/imbryk/LoopingViewPager. I managed to get the position works correctly. but i'm having a problem that the animation is quite slow or i may say it delays when i swipe fast, it seems ok when i swipe slower as you can see in my video. Much appreciate if you could have a look at my repository: https://github.com/jintoga/TestInfiniteSwipeGallery
How can I use this lib & achieve backward compatibility up-to minSdk = 10 ?
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setBackgroundResource(int)' on a null object reference
at me.relex.circleindicator.CircleIndicator$1.onPageSelected(CircleIndicator.java:179)
at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1862)
at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:625)
at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:609)
at android.support.v4.view.ViewPager.onTouchEvent(ViewPager.java:2174)
at android.view.View.dispatchTouchEvent(View.java:8400)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2427)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2159)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2433)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2173)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2390)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1741)
at android.app.Activity.dispatchTouchEvent(Activity.java:2827)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2351)
at android.view.View.dispatchPointerEvent(View.java:8590)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4104)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3970)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3494)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3547)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3513)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3623)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3521)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3680)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3494)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3547)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3513)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3521)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3494)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5799)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5773)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5744)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5922)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:143)
at android.os.Looper.loop(Looper.java:122)
at android.app.ActivityThread.main(ActivityThread.java:5354)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Hi,
Thanks for your project, it has been very helpful in getting a ViewPager working with an indicator. I'd like to use some of your code in my app, what license is this open-sourced under?
Thanks,
Sean
I am not able to change the white_radius colour in CircleIndicator library . Is it possible ?
Hi,
all dots are white until change page.
As recyclerView is the new standard, that may be interesting.
In usual samples, when you have your ViewPager already filled with items, CircleIndicator works correctly, but when Adapter has no items, (in case of loading something from web and populating later on), there is crash.
I think you need to check if position is -1 before doing anything in onPageSelected method.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.