Android Custom-Toast

Additional

Language
Java
Version
1.0.1 (Sep 11, 2017)
Created
Sep 12, 2017
Updated
Sep 30, 2017
Owner
Shivam Agrawal (shivam-ai)
Contributors
MayankAgrawal01
Shivam Agrawal (shivam-ai)
2
Activity
Badge
Generate
Download
Source code
APK file

Show card

Android-CustomToast

Watch this video

Android-CustomToast is a powerful & easy to use Custom Toast library for Android. It runs on API level 14 and upwards. This library provides some predefined custom toast. Also you can coustomize the toast according to your need

⚡️A Single line of code can add a beautiful toast message in your app. ⚡️

Code Output
CT.success(this, "Success");
CT.success2(this, "Success");
CT.failed(this, "Failed");
CT.failed2(this, "Failed");
CT.loading(this, "Loading...");
CT.loading2(this, "Loading...");
CT.mute(this, "Silent mode");
CT.mute2(this, "Silent mode");
CT.normal(this, "Normal Toast");
CT.normal2(this, "Normal Toast");
Custom Toast
Custom Toast2

Setup

Gradle dependency (recommended)

  • Add the following to your project level build.gradle:
allprojects {
 repositories {
  maven { url "https://jitpack.io" }
 }
}
  • Add this to your app build.gradle:
dependencies {
 compile 'com.github.shivam301296:Android-CustomToast:1.0.1'
}

Or use Maven

  • Add the following to the <repositories> section of your pom.xml:
<repository>
       <id>jitpack.io</id>
       <url>https://jitpack.io</url>
</repository>
  • Add the following to the <dependencies> section of your pom.xml:
<dependency>
       <groupId>com.github.shivam301296</groupId>
         <artifactId>Android-CustomToast</artifactId>
         <version>1.0.0</version>
</dependency>

Documentation

For a detailed documentation 📔, please have a look at the Wiki

For using predefined Toast

Refer to the above table (Code and Output)

For using Custom Toast

new CT.Builder(this, "Your message")
            .textCol(Color.BLACK)
            .backCol(Color.YELLOW)
            .borderCol(Color.BLACK)
            .borderWidth(20)
            .image(R.drawable.apple)
            .gravity(Gravity.CENTER)
            .radius(80,0,0,80)
            .show();
Method Use
textCol(int color) Set text color
backCol(int color Set background color
borderCol(int color) Set border color
borderWidth(int width Set border width
image(int imageResource) Set image in the toast
gravity(int gravityConstant) Set Toast gravity (Location)
radius(int topLeft, int topRight, int bottomLeft, int bottomRight), Set toast layout corner radius
shape(int shape) Set toast shape
duration(int duration) Set toast duration
show() Don't forget to call this method

Works on

  • Android 4.0.1 (Ice Cream Sandwich) and above.

Permissions

  • Does not require any special permission

Built With

Third party libraries

  • No external library dependency

Authors

Version

  • Version 1.0.1

License