Code Monkey home page Code Monkey logo

toastutils's Introduction

ToastUtils

安卓版本自定义Toast提示!


截图

使用方法

Gradle

compile 'com.lihaodong.toast:toastlibrary:1.0.1'

Maven

<dependency>
  <groupId>com.lihaodong.toast</groupId>
  <artifactId>toastlibrary</artifactId>
  <version>1.0.1</version>
  <type>pom</type>
</dependency>

Eclipse ADT

放弃治疗。

初始化

初始化 ToastUtils,并设置 ToastUtils 建议把初始化方法放到 Application 中 onCreate 生命周期 方法里面。还有别忘了在manifest.xml中注册Application。

HToast.newBuilder(this)
      ...
      .build();

关于HToast的说明

HToast默认提供htoast提供的颜色,可在Application里面统一配置全局设置

setTextColor(R.color.white)// 设置提示字体颜色
setSuccessBgColor(R.color.htoast_success)// 设置提示成功的背景颜色
setErrorIcon(R.color.htoast_error)//设置提示失败的背景颜色
setWarningBgColor(R.color.htoast_warning)//设置提示警告背景颜色
setInfoBgColor(R.color.htoast_info)//设置提示信息背景颜色

setWarningIcon(R.drawable.htoast_warning)//设置提示警告图标
setErrorIcon(R.drawable.htoast_error)//设置提示失败图标
setSuccessIcon(R.drawable.htoast_success)//设置提示成功图标
setInfoIcon(R.drawable.htoast_info)//设置提示信息图标

setShowIcon(false)//设置提示图标是否显示

setDuration(1000)//设置提示延迟时间

调用

 HToast.success("我成功了");
 HToast.error("我错了");
 HToast.normal("我正常了");
 HToast.warning("我被警告了");
 HToast.info("我是一条信息");
 

友好的调试模式

java

License

Copyright 2017 Li Haodong

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

toastutils's People

Contributors

lihaodong avatar

Stargazers

hilary 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.