10

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

I have to show a Toast, when the user presses a Button, but I want to show it a little more down on the screen.

How can I do this?

This is the code of my Toast:

Toast.makeText(getApplicationContext(),
getString(R.string.emailregisternotentered),
Toast.LENGTH_SHORT).show();

Solved:

Toast toast= Toast.makeText(getApplicationContext(), 
getString(R.string.emailregisternotentered), Toast.LENGTH_SHORT);  
//Toast.makeText(getApplicationContext(), getString(R.string.emailregisternotentered),
//Toast.LENGTH_SHORT).show();
toast.setGravity(Gravity.BOTTOM, 0, 0);
toast.show();
Community
  • 1
  • 1
NullPointerException
  • 36,107
  • 79
  • 222
  • 382

2 Answers2

6

Here is the documentation:

http://developer.android.com/guide/topics/ui/notifiers/toasts.html#Positioning

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
2

Toast.setGravity is one option.

cx0der
  • 432
  • 5
  • 20