plattysoft / Leonids

A Particle System for standard Android UI: http://plattysoft.github.io/Leonids/
Apache License 2.0
2.28k stars 396 forks source link

ViewGroup and EmiterBackground #66

Closed MikelCalvo closed 7 years ago

MikelCalvo commented 7 years ago

Hi! Today I found a way to put particles inside a Fragment (#58) but now the problem i'm dealing with is that the constructor new ParticleSystem(ViewGroup parentView, Drawable drawable, int maxParticles, long timeToLive) cannot be used for the displaying the particles in the background because it throws the error android.support.v7.widget.AppCompatImageView cannot be cast to android.view.ViewGroup when new ParticleSystem(getActivity(), 50, R.drawable.animated_particles, 1000, R.id.background_hook) Any idea of how to fix this? Thanks for your time!

plattysoft commented 7 years ago

The exception is very clear, the hook is not a ViewGroup, but an AppCompatImageView.

The hook view needs to be a ViewGroup so the ParticleSystem (which is a View) can be made a child of it.

The simplest ViewGroup you can use is a FrameLayout.

Hope this helps.

MikelCalvo commented 7 years ago

@plattysoft Thanks!