Introduction

In this article, we are going to define a motion for a button in Android using Android Studio. It is a type of library that provides the motion for a button and also the given text. By using this, we can animate the button and also the text. This is one of the most widely-used Android libraries.
Step 1
Create a new project in Android Studio.
Android
Give a name to the project and click "Next".
Android
Select the "Phone and Tablet" option and click "Next".
Android
Select an empty activity and click "Next".
Android
At last, give the activity name and click on "Finish".
Android
Step 2
Locate the Gradle Scripts>>Build. Gradle 1.
Android
And, type the following dependency in your app's build.gradle.
Android
Then, click the sync button in the top right corner and repeat this for step 4.
Android
Code copy is here
  1. maven {
  2. url 'https://dl.bintray.com/spark/maven'
  3. }
Step 3
Locate the Gradle Scripts>>Build. Gradle 2.
Android
Type the following dependency in your app's build.gradle.
Android
The code copy is here.
  1. compile 'me.spark:submitbutton:1.0.1'
Step 4
Next, go to app >> res >> layout >> activity_main.xml. Select activity page.
Android
Just type the code as follows.
Android
The code copy is here.
  1. <com.spark.submitbutton.SubmitButton
  2. android:layout_width="match_parent"
  3. android:layout_height="match_parent"
  4. android:text="FINISH"
  5. android:textColor="@color/gray"
  6. app:sub_btn_background="@color/white"
  7. app:sub_btn_duration="3000"
  8. app:sub_btn_line_color="@color/colorAccent"
  9. app:sub_btn_ripple_color="@color/black"
  10. app:sub_btn_tick_color="@color/white"
  11. tools:ignore="HardcodedText"
  12. tools:layout_editor_absoluteX="0dp"
  13. tools:layout_editor_absoluteY="120dp" />
Step 5
Next, go to app >> java>>Mainactivity.java. Select Mainactivity page.
Android
And check whether it is the default.
Android
Step 6
Verify the preview.
After the code is applied, the preview will appear like this.
Android
Step 7
Next, go to Studio and deploy the application. Select an Emulator or your mobile with USB debugging enabled. Give it a few seconds to make installations and set permissions.
Android
Run the application in your desired emulator (Shift + F10).
Android
Explanation of source code
The source code used in the activitymain.xml file will perform the motion for the given button. The motion is based on the dependency you added.

Summary

We have just created the app to see how the button motion works and learned how to use it.
*Support and Share, Thank You*