A simple android custom toast(Simplified version of SuperToasts).
- Basic
XToast.create(Context, "Text to show").show();
- Custom
XToast.create(Context, "Text to show").withTextSize(20).withBackgroundColor(Color.parseColor("#FF00000")).show();
All configurations are in the form of withXxx() methods.
It now supports the following configurations:
withTextSize(int)
withTextColor(int)
withDuration(int)
There are several build-in duration in XToast.Duration.
Use XToast.Duration.FOREVER if you do not want it dismissed automatically.
withBackgroundColor(int)
withBackgroundResource(int)
withAnimation(int)
There are several built-in animations in XToast.Anim.
withGravity(int, int, int)
withCover(boolean)
Cancel all the other toasts before this one shows.
withButton(CharSequence, Drawable, XToast.ButtonClickListener)
withButton(CharSequence, Drawable, XToast.ButtonClickListener, boolean)
withButton(CharSequence, int, XToast.ButtonClickListener)
withButton(CharSequence, int, XToast.ButtonClickListener, boolean)
Note: If you want to show only the button, with no toast text, just do like this:
XToast.create(Context, null).withButton(...);
withPosition(View, int, int, int)
See position options in XToast.Position.
Note: After calling this method, do not call withGravity() anymore because they could be messed up.




