In Android I want to display a toast message at the bottom of the screen, I tried this:
Toast.makeText(test.this,"bbb", Toast.LENGTH_LONG).show();
It doesn't work, how do I do it correctly?
In Android I want to display a toast message at the bottom of the screen, I tried this:
Toast.makeText(test.this,"bbb", Toast.LENGTH_LONG).show();
It doesn't work, how do I do it correctly?
In Xamarin.Android, this displays toast at center of screen:
The below code worked for me.
Layout file for custom toast
.java file for custom toast on button's click event
}
Positioning your Toast
A standard toast notification appears near the bottom of the screen, centered horizontally. You can change this position with the
setGravity(int, int, int)
method. This accepts three parameters: aGravity
constant, anx-position
offset, and ay-position
offset.For example, if you decide that the toast should appear in the top-left corner, you can set the gravity like this:
If you want to nudge the position to the right, increase the value of the second parameter. To nudge it down, increase the value of the last parameter.
To display the Toast in center of the screen.