Friday, April 7, 2017

How to create a custom loading popup with many images

Do you want to create your own custom popup? So you come to the right site for this. To create it we may use many images and each image is different like these:

We will create animation xml first by right click of the res -> New -> Android Resource File



Don't forget to copy all images to a drawable folder in the android studio. And then we will create xml for animation like below:
And then we will create a class to handle the loading like below and you read some comments to understand more about the code:
Create a layout.xml and create ImageView by providing the width, height, and background. For background property, we will use the drawable animation that we created above.

Create an Activity so you call MainActivity, so Android Studio will create the xml layout automatically. In this xml layout we will create TextView and create an Event Click After the user clicks this TextView, it will show the popup.



In MainActivity class we call TextView ID and provide the action to handle an action when the user clicks on it.


Click here to download the source code


1 comment: