Giter Site home page Giter Site logo

shenhaiyi / snackbartoast Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 0.0 3.44 MB

一个自定义Toast,实现了Snackbar在顶部弹出的效果,具有Toast的属性,它可以不受权限限制显示在状态栏之上,同时可以显示在应用程序外部。

Java 100.00%

snackbartoast's Introduction

SnackbarToast

一个自定义Toast,实现了Snackbar在顶部弹出的效果,具有Toast的属性,它可以不受权限限制显示在状态栏之上,同时可以显示在应用程序外部。

//显示一个错误提示
SnackbarToast.make(context, "ERROR", 2000l)//三个参数分别是上下文,显示文本和显示时间
        .setPromptThemBackground(Prompt.ERROR)
        .show();
//显示一个成功提示
SnackbarToast.make(context, "SUCCESS", 2000l)
        .setPromptThemBackground(Prompt.SUCCESS)
        .show();
//自定义
SnackbarToast s = SnackbarToast.make(this, "自定义内容", 2000l)
        .addIcon(R.mipmap.ic_launcher_round)//添加一个图片
        .setBackgroundColor(R.color.colorAccent)//设置一个背景色
        .show();
//显示警告提示
SnackbarToast.make(context, "WARNING", 2000l)
        .setPromptThemBackground(Prompt.WARNING)
        .show();
//显示一个自定义View
SnackbarView myView = (SnackbarView) LayoutInflater.from(this).
    inflate(R.layout.view_toast_layout, null);
MyToast myToast = new MyToast(context, myView);
mParams(myToast.getWindowParams());
myToast.show();

snackbartoast's People

Contributors

shenhaiyi avatar

Stargazers

小马哥nice avatar 夏虫语冰 avatar NiceCoder avatar Yunfei Wang avatar wengzc avatar metasaber avatar 红河 avatar ldw_wow avatar chenggoi avatar Chen avatar  avatar WangYS avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.