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
  • 34,337
  • 71
  • 211
  • 357

2 Answers2

6

Here is the documentation:

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

Daniel A. White
  • 181,601
  • 45
  • 354
  • 430
2

Toast.setGravity is one option.

cx0der
  • 432
  • 6
  • 20