Coder Social home page Coder Social logo

Make raining animation about leonids HOT 3 CLOSED

plattysoft avatar plattysoft commented on September 21, 2024
Make raining animation

from leonids.

Comments (3)

plattysoft avatar plattysoft commented on September 21, 2024

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.

strictlad avatar strictlad commented on September 21, 2024

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.

plattysoft avatar plattysoft commented on September 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.