When I use Toast
to display some popup text on the screen, it displays the text a little bit above the bottom of the screen, which is the default position.
Now I want to display it in the middle of screen or somewhere according to my choice.
Can anyone guide me how to achieve this?
setting toast at topin screen
now at bottom
the same way we can set toast in left, right and also center
Click here
The method to change the color, position and background color of toast is:
For line by line explanation: https://www.youtube.com/watch?v=5bzhGd1HZOc
From the documentation,
The above code is will help u to display toast in the middle of screen or according to ur choice for that just set the toast gravity according to ur need
Note: For this process u have to use object of Toast
//A custom toast class where you can show custom or default toast as desired)
As an aside if you get the error indicating that you must call makeText, the following code makes it work: