Comments (3)
The code looks correct, it actually looks pretty much like the rain example.
The only reason that comes to mind for what you are describing is that anchor view is actually on the corner. Try making the cloud view visible and see where it draws.
Also, I recall there is one bug about one particular alignment that was fixed in the latest code, did you checked out the last version?
Apart from coloring the background of the view and playing with different alignments, there is little more to change. You can always get the rain example and modify it once you see it working.
Hope this helps.
from leonids.
Hi @plattysoft,
I find that if I put the code in OnClickListener of the widget, the rain animation will work well. However, if I put this code in other places, example onCreate(), the result will show as I describe above.
I want to see my rain without clicking anything.
Are there solutions for my problem?
Thanks your help.
from leonids.
Ah, I see the problem, 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
from leonids.
Related Issues (20)
- 为什么用不了呀
- EmiterWithGravityExampleActivity ,How to make particles fly upward? HOT 1
- How to change TIMER_TASK_INTERVAL? HOT 2
- OneShot method doesn't call onDraw(); HOT 2
- Particle slowdown (air resistance)
- Copyright statement missing
- How to change the direction of the animation
- Use Leonids as a shared transition view HOT 1
- Emitters freeze after several seconds when built from latest tools HOT 3
- Particle Wall HOT 1
- Reverse Animation
- Rootview elevation HOT 2
- Bug causing crash
- Bug causing crash HOT 3
- JCenter shutdown HOT 5
- Top !!
- Typo in ParticleSystem class HOT 1
- Crash detected in onUpdate(long miliseconds) function
- java.lang.NullPointerException
- NPE HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leonids.