This is a very simple toast library. You can customize your toast messages using this library.
To start using this library add the following line in the dependecy section of your (Module:app) gradle file.compile 'com.github.vipul:customtoastlibrary:1.0'
Using this library is very simple, just create an object of CustomToast class and pass Application's context and toast message as parameters.
CustomToast customToast = new CustomToast(getApplicationContext(),"Hello World");
customToast.showToast();
The showToast method displays the toast message in the android app. Now to customize your toast you can call various methods on
CustomToast's object that you just created. Following is the description of some of the methods available in the library.
void setTextSize(float size)
- Changes the toast's text sizevoid setTextColor(int color)
- Changes the toast's text color. Eg. Pass COLOR.RED as argument to this function to change text color to red.void setBold(float size)
- Makes the toast content appear in bold.void setItalics(float size)
- Makes the toast content appear in italics.void setBackgroundColor(int color)
- Pass a color int value to set the background color, such as COLOR.rgb().void setToastIcon(int image)
- Takes a drawable as argument and displays the drawable image in the toast.void setDuration(String duration)
- Change toast's duration by passing a string "long" or "short".