zoukankan      html  css  js  c++  java
  • Android Toast的多功能封装——Android开发之路1

    Android封装实现各种功能的Toast

    GitHub地址:https://github.com/SibreiaDante/ToastUtils

    效果图:

    方法封装如下:

    showSingletonLong(String content):Toast文本,单例,长时间
    showSingletonShort(String content):Toast文本,单例,短时间
    showTextShort(String content):Toast文本,非单例,短时间
    showTextLong(String content):Toast文本,非单例,长时间
    showSingletonText(String content,int duration,int position ):Toast文本,自定义时长、位置
    showSingletonImageCenter(int resId, int duration): Toast一张图片,单例,居中
    showImageCenter(int resId,int duration):Toast一张图片,非单例,居中
    showSingletonImage(int resId, int duration, int position):Toast一张图片,单例,自定义位置
    showImage(int resId, int duration, int position):Toast一张图片,非单例,自定义位置
    showImage(Bitmap bitmap, int duration, int position):Toast一张图片,非单例,自定义位置
    showITSingleton(int resId, String content, int duration, int position):Toast图文,单例,自定义时长,自定义位置
    showIT(int resId, String content, int duration, int position):Toast图文,非单例,自定义时长,自定义位置
    showLines(List contents, int size):Toast 多行文本 非单例
    showSingletonLines(List contents, int size):Toast 多行文本 单例
    showLayout(View view, int duration, int position):Toast 自定义布局 非单例
    howSingletonLayout(View view, int duration, int position):Toast 自定义布局 单例
    showThread(String url):异步线程下载图片并Toast
    cancel():取消一个Toast,当弹出多个toast时,只会在最后一次toast被创建时取消
    cancelAll():取消创建的所有的toast
    使用说明:
    
    第一步,在你的工程中
        allprojects {
            repositories {
                ...
                maven { url 'https://jitpack.io' }
            }
        }
        dependencies {
                compile 'com.github.SibreiaDante:SiberiaDanteLib:v1.0.0'
        }
    
    第二部,在你的项目中初始化
    ToastApp.initToastUtils(getApplicationContext());
  • 相关阅读:
    win10+CUDA8.0+vs2013配置
    TX2更新源失败的问题
    并发编程--乐观锁与悲观锁
    并发编程--线程池
    并发编程--多线程基础(02)
    并发编程--多线程基础(01)
    搭建redis集群的过程中遇到的问题
    redis集群搭建(伪集群)
    关于maven项目中修改的JS不生效的解决方案
    【转载】IntelliJ IDEA 2017常用快捷键
  • 原文地址:https://www.cnblogs.com/shen-hua/p/6106303.html
Copyright © 2011-2022 走看看