Snackbar 提醒
类似于Toast,属于design包,不要忘记导入design
package com.xiaozhuyisheng.jinjiedemos.activity; import android.support.design.widget.Snackbar;
import android.view.View; import com.xiaozhuyisheng.jinjiedemos.BaseActivity;
import com.xiaozhuyisheng.jinjiedemos.R; import butterknife.BindView; // implementation 'com.android.support:design:28.0.0' public class SnackbarDemoActivity extends BaseActivity {
@BindView(R.id.testView)
View testView; @Override
protected int initLayoutID() {
return R.layout.activity_snacker;
} @Override
protected void initLogic() {
findViewById(R.id.btnHint).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showSnackbar();
}
});
} private void showSnackbar() {
Snackbar.make(testView,"标题",Snackbar.LENGTH_SHORT)
.setAction("点击事件", new View.OnClickListener() {
@Override
public void onClick(View view) { }
}).setDuration(Snackbar.LENGTH_LONG).show();
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提示"
android:id="@+id/btnHint"
/> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/testView"
> </LinearLayout> </android.support.constraint.ConstraintLayout>
Snackbar 提醒的更多相关文章
- Android——MaterialDesign之四 FloatingActionButton、Snackbar、CoordinaterLayout
FloatingActionButton 悬浮按钮,默认colorAccent来作为按钮的颜色 <android.support.design.widget.FloatingActionButt ...
- Android开发——你真的了解Dialog、Toast和Snackbar吗
0. 前言 今天给大家带来一篇简单易懂的关于Android提醒小功能的文章.Dialog和Toast我们都不陌生,而Snackbar是Design Support库中提供的新控件,有些朋友可能还不了解 ...
- Android学习之CoordinatorLayout+FloatingActionButton+Snackbar
CoordinatorLayout •简介 CoordinatorLayout 协调布局,可以理解为功能更强大的 FrameLayout 布局: 它在普通情况下作用和 FrameLayout 基本一致 ...
- PHP实现RTX发送消息提醒
RTX是腾讯公司推出的企业级即时通信平台,大多数公司都在使用它,但是我们很多时候需要将自己系统或者产品的一些通知实时推送给RTX,这就需要用到RTX的服务端SDK,建议先去看看RTX的SDK开发文档( ...
- 客服小妹是如何泡到手的——C#定时提醒·语音录制·语音播放·文件转录Demo源码——倾情奉献!
一.需求提出 客服小妹跟我说,每天要统计新加好友数,得先记下昨天的数目,然后查看今天的数目,还要相减,打字,记录——好麻烦! 又说,客户多的时候,忙起这头忘了那头,文字记录备忘又太费劲! 我说,赐你一 ...
- 安卓Design包之超强控件CoordinatorLayout与SnackBar的简单使用
在前面的Design中,学习使用了TabLayout,NavigationView与DrawerLayout实现的神奇效果,今天就带来本次Design包中我认为最有意义的控件CoordinatorLa ...
- Android 提醒公共方法 Notification
SimpAndroidFarme是近期脑子突然发热想做的android快速开发的框架,目标是模块化 常用的控件,方便新手学习和使用.也欢迎老鸟来一起充实项目:项目地址 今天的目标是做一个公共的提醒方法 ...
- textView的提醒文字
如果我们想提交一些备注信息,会想到用textFiled和textView两种控件去实现 1.提醒文字是textFiled的特有属性,但是textFiled显示文本只有一行,不能实现我们输入较多文字的情 ...
- Matlab与Windows桌面提醒
最近在实验室用Matlab做实验,一次训练下来最少得也得5到10分钟吧.在Matlab运行的过程中,又不太好去做别的事情,因为5到10分钟的时间实在有点短.但是,眼睁睁看着代码的运行的话,5分钟又实在 ...
随机推荐
- Spring Security 之基本概念
Spring Security 是一个安全框架, 可以简单地认为 Spring Security 是放在用户和 Spring 应用之间的一个安全屏障, 每一个 web 请求都先要经过 Spring S ...
- [物理学与PDEs]第1章第3节 真空中的 Maxwell 方程组, Lorentz 力 3.2 Lorentz 力
1. Lorentz 假定, 不论带电体的运动状态如何, 其所受的力密度 (单位体积所受的力) 为 $$\bex {\bf F}=\rho {\bf E}+{\bf j}\times{\bf B} = ...
- 运维工作笔记——基于centos7.3的多台服务期时间同步
1. 确认服务器版本 2.查看本机时间 3.可以同过date进行时间更改 4.yum安装ntp服务(服务端与客户端都需要安装) yum install -y ntp 5.在服务端192.1 ...
- Nginx故障排错及一个网站小实例
Nginx访问403错误: 1.没有首页文件 2.没有权限 例:chmod 700 /application/nginx/html/index.html 3.nginx.conf配置文件和首页文件不 ...
- xls表格 ctrl+D 和ctrl+Enter区别 --快速填充相同数据,同时填充多个不同数据
一.ctrl+Enter应用 如何快速实现下图两个图的填充值效果? ==>效果 1. 选择A列,或者所需要填充的范围 (下面利用 ctrl+G定位应用) 2.Ctrl+G 定位 选择 空值 在 ...
- Django之AJAX
一.预备知识JSON python中的json: json.dumps( ) json.loads( ) JavaScript中的json:JSON.stringify( ) J ...
- vue ajax返回html代码不渲染解决
<span v-html='lists.html'></span>
- 用JS实现实时显示系统时间
废话我就不多说了,直接上图和代码了 效果图: 代码视图: 下面为大家附上代码,复制即可用: <!DOCTYPE html> <html lang="en"> ...
- 带问号的括号匹配问题918C 1153C
cf里好像经常出 这些题,一般贪心是搞不了的.. 918C 问有多少子段[l,r]满足合法括号 先从左往右扫,如果问号+‘(' 数量 >= ')' 说明这段区间的 ) 是满足条件的 然后再从右往 ...
- sqlserver(查看被锁进程)
-- ###### 查看被锁进程 ###### select 标志, 进程ID=spid,线程ID=kpid,块进程ID=blocked,数据库ID=dbid, 数据库名=db_name(dbid), ...