Skip to content
Related Articles

Related Articles

Improve Article

Liquid Button in Android

  • Last Updated : 06 Jun, 2021
Geek Week

In this article we are going to implement a liquid button library, This can be used to show animation on a button. When a user completed a course or completes Filling all the details on a form successfully, then we can show this liquid button to show success in a good way. Let’s see the implementation of this feature. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language. 

Liquid Button in Android

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.

Step 2: Add dependency

Navigate to the Gradle Scripts > build.gradle(Module:app) and add the below dependency in the dependencies section.   

compile ‘com.gospelware.liquidbutton:liquidButtonLib:1.1.5’

Step 3: Working with the activity_main.xml file

Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. 


<?xml version="1.0" encoding="utf-8"?>
        android:layout_centerInParent="true" />

Step 4: Working with the file

Go to the file and refer to the following code. Below is the code for the file. 


import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.gospelware.liquidbutton.LiquidButton;
public class MainActivity extends AppCompatActivity {
    protected void onCreate(Bundle savedInstanceState) {
        final LiquidButton liquidButton = findViewById(;
        liquidButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                LiquidButton btn = (LiquidButton) view;
        liquidButton.setPourFinishListener(new LiquidButton.PourFinishListener() {
            public void onPourFinish() {
                Toast.makeText(MainActivity.this, "Finish", Toast.LENGTH_SHORT).show();
            public void onProgressUpdate(float progress) {


Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :