I want to create a toast message with background color is white and message color is black. My toast message is:
Toast.makeText(Logpage.this, "Please Give Feedback...", 3000).show();
I wanted to create it in another method not in onCreate()
.
I want to create a toast message with background color is white and message color is black. My toast message is:
Toast.makeText(Logpage.this, "Please Give Feedback...", 3000).show();
I wanted to create it in another method not in onCreate()
.
If you want to change the background you have to use custom layout in toast
To Change the default
Toast
Text Color and Background color Try Like this.Change Toast Colours without any additional Layouts, 2018
This is a very easy way I've found of changing the colour of the actual image background of the Toast as well as the text colour, it doesn't require any additional layouts or any XML changes:
Create a layout file toast.xml as to how your toast should look as below:
To show the toast in the java file put the below code:
Adding to @AndroidKiller's answer, you can also set the
gravity
and a customTextView
among other things like so:Note, your background drawable should be a nine-patch PNG
You can even put an
ImageView
, and multipleTextView
s in with XML like this: