Skip to content
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

Example of particle system on the background #88

Open
nikolaGithub2018 opened this issue Jan 10, 2018 · 4 comments
Open

Example of particle system on the background #88

nikolaGithub2018 opened this issue Jan 10, 2018 · 4 comments

Comments

@nikolaGithub2018
Copy link

nikolaGithub2018 commented Jan 10, 2018

If we have for example, some layout like this:
< ScrollView >
< LinearLayout >
-Button0
-Button1
-Button2
-Button3
...
< / LinearLayout >
</ ScrollView >

How to set ParticleSystem constructor which will emit particles behind all those buttons (I need particles to show only in background, not to fall in front of buttons)???

this will not work>
ParticleSystem(activity, maxParticles, drawableRedId, timeToLive, idOfLinearLayoutFromExampleAbove)

@plattysoft
Copy link
Owner

plattysoft commented Jan 10, 2018

The anchor view for the particle system is the one that will be used as a parent for the particle system, if you want it to be on the background you need something like this:

<FrameLayout>
 <your layout />
</FrameLayout>

And make the FrameLayout be the anchor. I may need to check if the Particle system is added as a child at the end or at the beginning, to be sure, you can have another FrameLayout to be the first child of the FrameLayout and use that one as the anchor

@nikolaGithub2018
Copy link
Author

Thanks for fast reply, I really appreciate it.
I tried that and it did not work, although I am not sure I understood your post entirely.
Would you mind to write the exact constructor call for layout below:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/frame_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

	<ScrollView
		android:id="@+id/scroll_view"
		android:layout_width="match_parent"
		android:layout_height="match_parent">

		<LinearLayout
			android:id="@+id/linear_layout"
			android:layout_width="match_parent"
			android:layout_height="match_parent"
			android:orientation="vertical"
			>
			
			<Button
				android:id="@+id/button0"
				...
				/>

		</LinearLayout>
	</ScrollView>
</FrameLayout>

Thanks man ;)

@plattysoft
Copy link
Owner

Try adding another FrameLayout before the ScrollView and using that one as an anchor, that should work (I mentioned it briefly on my previous comment, I didn't remember how it was implemented 100%)

@nikolaGithub2018
Copy link
Author

Great, it works :)
Just call
new ParticleSystem(this, 80, bitmap, 10000, R.id.frame_anim_background)
with this layout:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
        
      <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/frame_anim_background">
      </FrameLayout>

	<ScrollView
		android:layout_width="match_parent"
		android:layout_height="match_parent">

		<LinearLayout
			android:layout_width="match_parent"
			android:layout_height="match_parent"
			android:orientation="vertical"
			>
			
			<Button
				android:id="@+id/button0"
				...
				/>

		</LinearLayout>
	</ScrollView>
</FrameLayout>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants