-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Particles without onclick call Example #22
Comments
This is duplication of #21, but at least your title and code explanation is much more detailed and clear. Actually it is a great report. I'm doing a copy and paste from the other ticket: It is due to how Android works. For the particle system to work fine, the views must be measured when it is created. Inside onCreate the Views are not yet measured, just created. You need to set a ViewTreeObserver to know when the layout has been measured. This is a standard question on Android, check out this link on Stack Overflow, it is exactly the same problem: http://stackoverflow.com/questions/3779173/determining-the-size-of-an-android-view-at-runtime That being said, I'd leave this one open because I want to improve the code so this special case can be done automatically. I'm afraid that, in the meantime, you need to go with the ViewTreeObserver |
Thanks for your help, that works with the ViewTreeObserver ;) |
Hey, I was also having a problem with all particles showing up on top left corner regardless of anchor view positions on launch. The problem was the anchor view was not ready while starting the animation. So you can put the animation code inside View.post(Runnable) or View.postDelayed(Runnable) method. This fixed the issue of particales whithout onclick for me. findViewById(R.id.center_anchor).post(new Runnable() { If this helps out, Good Luck :) |
Posting a runnable, even with a delay does not guarantee a fix. You need to start the emitter after the views have been measured. Posting a runnable is a gamble that works 99.9% of the time, but if the phone is slow for whatever reason, it will not work. |
Hey,
I'm using this wonderful library but i'm blocked to animate particles without a touch on a button.
I have a Xml view with
And an actvity with
That code is okay. I have particles around the button.
But if i start the animation programatically without onclick event I have the animation in the top left corner --'
It's the same with
Thank you in advance for any help you can provide
The text was updated successfully, but these errors were encountered: