How to Create Shine Effect in Android?
Shine Effect is used to give an ImageView, Button, or a View a better animation look. It is very easy to implement. 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 Kotlin language.
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 Kotlin as the programming language
Step 2: Working with the activity_main.xml file
Go to the activity_main.xml file and refer to the following code. Below is the code for the activity_main.xml file.
Step 3: Create bg_circular.xml inside the drawable folder we will use it as the background of the Linear Layout
Step 4: Create bg_shine.xml inside the drawable folder we will use this as the background of our animating view
Step 5: Create left_right.xml inside the anim folder of res. We will use this animation to show it in our View
Refer to this article How to Create Anim Folder & Animation File in Android Studio.
Step 6: Working with the MainActivity.kt file
Go to the MainActivity.kt file and refer to the following code. Below is the code for the MainActivity.kt file. Comments are added inside the code to understand the code in more detail.
Github repo here.