-  - The Android Arsenal – Toasts -  - The Android Arsenal – Toasts

Custom toast messages.

  • You can create customizable toast messages with KToast.
  • Use KToast.LENGTH_AUTO for unnormally long texts.
  • You can use Gravity.BOTTOM, Gravity., Gravity.LEFT or Gravity.RIGHT for toast position on screen.

*K is not .

Cases :

-  - The Android Arsenal – Toasts

Examples :

// Success
KToast.successToast(YourActivity.this, "This is a success toast.", Gravity.BOTTOM, KToast.LENGTH_AUTO);

// Info
KToast.infoToast(YourActivity.this, "This is a info toast.", Gravity.BOTTOM, KToast.LENGTH_SHORT);

// Normal
KToast.normalToast(YourActivity.this, "This is a normal toast.", Gravity.BOTTOM, KToast.LENGTH_LONG, R.drawable.ic_infinite_white);

// Warning
KToast.warningToast(YourActivity.this, "This is a warning toast.", Gravity.BOTTOM, KToast.LENGTH_AUTO);

// Error
KToast.errorToast(YourActivity.this, "This is a error toast.", Gravity.BOTTOM, KToast.LENGTH_AUTO);

// Custom Color
KToast.customColorToast(YourActivity.this, "This is a custom color toast.", Gravity.BOTTOM, KToast.LENGTH_AUTO, R.color.fuchsia, R.drawable.ic_infinite_white);

// Custom Drawable
KToast.customBackgroudToast(YourActivity.this, "This is a custom drawable toast.", Gravity.BOTTOM, KToast.LENGTH_AUTO, R.drawable.background_toast, null ,R.drawable.ic_infinite_white);


Step 1. Add the JitPack repository to your build file.

allprojects {
    repositories {
      maven { url '' }

Step 2. Add the dependency

dependencies {
  compile 'com.github.onurkagan:ktoast:1.0.2'

Source link


Please enter your comment!
Please enter your name here