loadToast浮动框加载提示(自用,记录用)
2015-06-11 15:29
169 查看
loadToast实现加载中,成功,失败浮动框提示。效果图如下:
Step 1
Gradle
Step 2
The API is very simple, create a new toast by providing a context:
Change the displayed text:
Then proceed to show the toast:
When your background thingy is done provide feedback to the user and hide the toast:
// Call this if it was successful
// Or this method if it failed
If you are using translucent actionbar in a full screen activity it will appear over the actionbar, fortunately there is a method to change the y translation:
You can also change the colors of the different toast elements:
These can be chained as you can see.
代码下载
Step 1
Gradle
dependencies { compile 'net.steamcrafted:load-toast:1.0.6' }
Step 2
The API is very simple, create a new toast by providing a context:
LoadToast lt = new LoadToast(context);
Change the displayed text:
lt.setText("Sending Reply...");
Then proceed to show the toast:
lt.show();
When your background thingy is done provide feedback to the user and hide the toast:
// Call this if it was successful
lt.success();
// Or this method if it failed
lt.error();
If you are using translucent actionbar in a full screen activity it will appear over the actionbar, fortunately there is a method to change the y translation:
lt.setTranslationY(100); // y offset in pixels
You can also change the colors of the different toast elements:
lt.setTextColor(Color.RED).setBackgroundColor(Color.GREEN).setProgressColor(Color.BLUE);
These can be chained as you can see.
final String text = "登录中,请稍等..."; final LoadToast lt = new LoadToast(this).setText(text).setTranslationY(100); //lt.setTextColor(Color.RED).setBackgroundColor(Color.GREEN).setProgressColor(Color.BLUE); findViewById(R.id.show).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { lt.show(); } });
代码下载
相关文章推荐
- Unity项目内各种文件的作用
- Android主界面连续两次点击物理返回键退出应用功能实现
- IOS用CGContextRef画各种图形(文字、圆、直线、弧线、矩形、扇形、椭圆、三角形、圆角矩形、贝塞尔曲线、图片)
- Cannot find any information on property 'User' in a bean of type 'com.entity.user'
- http://www.cocoachina.com/special/swift/
- 普通人怎么立志--再温《HP大中华区总裁孙振耀退休感言》(续)
- ACM学习
- 开源爬虫软件汇总
- 微信支付的常见问题,invalide code
- 创建Android启动界面
- int 与char数组之间的转换
- 12胜者树和败者树
- sql注入攻击(三)sql注入解决办法
- android 计算所在周所在月的前后日期
- 好工作?工作快乐么?再温《HP大中华区总裁孙振耀退休感言》(续)
- 数据对齐,有效对齐值(转载)
- 4-5轮选区的不透明度1.7
- C#画笔Pen画虚线的方法
- 解决git Push时请求username和password,而不是ssh-key验证
- SWIG实现C/C++与其他语言间的互相调用-----