开发者

It is possible to specify the position of a Toast? [duplicate]

This question already has answers here: Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜