It is possible to specify the position of a Toast? [duplicate]
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.emailregisternoten开发者_开发知识库tered),
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();
Here is the documentation:
http://developer.android.com/guide/topics/ui/notifiers/toasts.html#Positioning
Toast.setGravity is one option.
精彩评论