Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA Tutorial
  • Data Structures
  • Algorithms
  • Array
  • Strings
  • Linked List
  • Stack
  • Queue
  • Tree
  • Graph
  • Searching
  • Sorting
  • Recursion
  • Dynamic Programming
  • Binary Tree
  • Binary Search Tree
  • Heap
  • Hashing
  • Divide & Conquer
  • Mathematical
  • Geometric
  • Bitwise
  • Greedy
  • Backtracking
  • Branch and Bound
  • Matrix
  • Pattern Searching
  • Randomized
Open In App
Next Article:
ParticleView in Android with Examples
Next article icon

ParticleView in Android with Examples

Last Updated : 13 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

ParticleView is an animation library and animations help to gain the attention of the user so it is best to learn it. It is the custom Android view that helps to display a large number of fairies.

Why ParticleView?

  • ParticleView provides a predefined layout type and animation.
  • ParticleView can be used in Splash Screen.
  • It is better to use ParticleView because of its UI because a good UI plays a very important role in an app.

Approach

Step 1: Add the support library in the root build.gradle file (not in the module build.gradle file).

allprojects {
repositories {
maven { url 'https://dl.bintray.com/wangyuwei/maven' }
}
}

Step 2: Add the support library in build.gradle file and add dependency in the dependencies section.

implementation 'me.wangyuwei:ParticleView:1.0.4'

Step 3: Add the following code in activity_main.xml file. In this file add the ParticleView to the layout. activity_main.xml

<?xml version="1.0" encoding="utf-8"?> <LinearLayout     android:background="@color/grey"     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     xmlns:pv="http://schemas.android.com/apk/res-auto"     android:orientation="vertical"     android:gravity="center">      <me.wangyuwei.particleview.ParticleView         android:id="@+id/particleView"         android:layout_width="match_parent"         android:layout_height="match_parent"         pv:pv_host_text="GeeksForGeeks"         pv:pv_host_text_size="32sp"         pv:pv_particle_text=".com"         pv:pv_particle_text_size="18sp"         pv:pv_text_color="@color/colorPrimary"         pv:pv_background_color="#FFF"         pv:pv_text_anim_time="2000"         pv:pv_spread_anim_time="300"         pv:pv_host_text_anim_time="1000" />  </LinearLayout> 

Step 4: Add the following code in MainActivity.java file. In this file add ParticleAnimationListner() which will get invoked automatically when animation ends. MainActivity.java

package org.geeksforgeeks.particleView;  import android.os.Bundle; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import me.wangyuwei.particleview.ParticleView;  public class MainActivity extends AppCompatActivity {      ParticleView particleView;      @Override     protected void onCreate(@Nullable Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);          particleView = findViewById(R.id.particleView);         particleView.startAnim();          // This listener will get invoked automatically when animation ends.         particleView.setOnParticleAnimListener(new ParticleView.ParticleAnimListener() {             @Override             public void onAnimationEnd() {                 Toast.makeText(MainActivity.this, "Animation is End!!", Toast.LENGTH_SHORT).show();             }         });     } } 


Output: Run on Emulator



Next Article
ParticleView in Android with Examples

M

madhavmaheshwarimm20
Improve
Article Tags :
  • Java
  • Android
  • DSA
  • Android-Animation
Practice Tags :
  • Java

Similar Reads

    Android ListView in Java with Example
    A ListView in Android is a type of AdapterView that displays a vertically scrollable list of items, with each item positioned one below the other. Using an adapter, items are inserted into the list from an array or database efficiently. For displaying the items in the list method setAdaptor() is use
    3 min read
    Spinner in Android with Example
    Android Spinner is a view similar to the dropdown list which is used to select one option from the list of options. It provides an easy way to select one item from the list of items and it shows a dropdown list of all values when we click on it. The default value of the android spinner will be the c
    4 min read
    Jetpack LiveData in Android with Example
    Android Jetpack is a suite of libraries to help developers follow best practices, reduce boilerplate code, and write code that works consistently across Android versions and devices so that developers can focus on the code they care about. Here, we are going to implement Jetpack Live Data in Android
    4 min read
    OpenIntents in Android with Example
    OI refers to the "OpenIntents" project in Android are a way for one app to request an action from another app. This can be done using either explicit or implicit intents, allowing them to share functionality. The OpenIntents project provides a set of commonly-used intents that can be used by develop
    4 min read
    Kotlin Flow in Android with Example
    Kotlin Flow is a tool that helps developers work with data that changes over time like search results, live updates, or user input. It’s part of Kotlin’s coroutines, which are used for writing code that doesn’t block the app while waiting for something to finish, like a network call or a file to loa
    8 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences