plattysoft / Leonids

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

Particle Elevation #96

Closed ManuMobsuccess13 closed 6 years ago

ManuMobsuccess13 commented 6 years ago

Hello I'm trying to set the particle animation in "background" , I mean behind my ImageView. I tried to set like this android:elevation="4dp" and android:translationZ="4dp" on my ImageView and that work with other element but my particle animation still continue to be in foreground Any issue ? Thanks good library btw :)

plattysoft commented 6 years ago

To do that you need to set the parent view. By default the ParticleSystem creates a view on foreground and attaches it to the root view, so it is on foreground. Defining the parent view allows you to put it on the background or even between the UI and a background image. The parent view is typically a FrameLayout that goes match_parent for width and height. There is an example that uses it: https://github.com/plattysoft/Leonids/blob/master/LeonidsExamples/src/main/java/com/plattysoft/leonids/examples/EmiterBackgroundSimpleExampleActivity.java

ManuMobsuccess13 commented 6 years ago

Thanks for your answer,

I'm using ConstraintLayout so that can maybe be different...

ManuMobsuccess13 commented 6 years ago

Here is my XML file

` <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bg_splash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_splashscreen">

<ImageView
    android:id="@+id/logo_text"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="36dp"
    android:layout_marginStart="37dp"
    android:layout_marginTop="8dp"
    android:src="@drawable/logo"
    android:elevation="4dp"
    app:layout_constraintBottom_toTopOf="@+id/guideline2"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintHorizontal_weight="0.1"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/guideline"
    app:layout_constraintVertical_weight="0.1"
    tools:ignore="ContentDescription" />

<android.support.constraint.Guideline
    android:id="@+id/guideline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    app:layout_constraintGuide_percent="0.26371" />

<android.support.constraint.Guideline
    android:id="@+id/guideline2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    app:layout_constraintGuide_percent="0.42074" />

</android.support.constraint.ConstraintLayout>`
ManuMobsuccess13 commented 6 years ago

I understood thanks !