1

Possible Duplicate:
how to change position of Toast in android?

Is there any method to align toast message in application.By default it always appears at the bottom of application. i did it like this... Toast.makeText(this, "hello !", Toast.LENGTH_LONG).show(); Thank you

Community
  • 1
  • 1
BIBEKRBARAL
  • 4,455
  • 9
  • 31
  • 30
  • It's a simple article it helps me a lot - [How to use toast in Android - click here](https://androidride.com/how-to-use-toast-in-android-example/) – Athira Reddy Apr 20 '19 at 02:45

2 Answers2

9
public void setGravity(int gravity, int xOffset, int yOffset)
Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98
Vishal Khakhkhar
  • 2,106
  • 3
  • 29
  • 60
  • 1
    Hi i did like this and now its working fine. Toast toast = Toast.makeText(this, "Welcome", Toast.LENGTH_LONG); toast.setGravity(Gravity.TOP | Gravity.LEFT, 40, 60); toast.show(); – BIBEKRBARAL Feb 21 '10 at 07:01
5

Toast.setGravity()

Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98
skyman
  • 2,422
  • 17
  • 16