Design Support Library中Snackbar控件的简单用法
来源:互联网 发布:魔法王座所有数据 编辑:程序博客网 时间:2024/05/04 23:55
//view是为其提供的一个父视图,确保snackbar显示在屏幕底部
Snackbar snackbar = Snackbar.make(view,R.string.MessageText,Snackbar.LENGTH_LONG);
//通过getView方法获取snackbar视图,然后可以用setBackgroundColor设置背景色
View snackBarView = snackbar.getView();snackBarView.setBackgroundColor(getResources().getColor(R.color.BackgroundColor));
//setActionTextColor函数可以修改右侧显示的Action(就是个TextView)的颜色snackbar.setActionTextColor(getResources().getColor(R.color.ActionTextColor));TextView snackbar_text = (TextView)snackBarView.findViewById(android.support.design.R.id.snackbar_text);if (snackbar_text != null){ snackbar_text.setTextColor(getResources().getColor(R.color.MessageTextColor));}snackbar.setAction(getResources().getText(R.string.ActionText), new View.OnClickListener(){ @Override public void onClick(View v) { }}).show();//SnackBar没有为显示的消息提供颜色的设置函数,如果需修改可按如下方法进行
0 0
- Design Support Library中Snackbar控件的简单用法
- design support library SnackBar简单使用
- Android Design Support Library 中控件的使用简单介绍
- Android Design Support Library(3)- Snackbar的使用
- Android Design Support Library--简约而不简单的SnackBar
- Android Design Support Library--简约而不简单的SnackBar
- Android Design Support Library 中控件的使用简单介绍(一)
- Android Design Support Library 中控件的使用简单介绍(一)
- Android Design Support Library 中控件的使用简单介绍(一)
- Android Design Support Library 中控件的使用简单介绍(一)
- Android Design Support Library 中控件的使用简单介绍(二)
- Android Design Support Library实践之Snackbar
- Design Support Library第三部分:Snackbar样式
- (4.1.43.2)design support library:Snackbar
- Android Design Support Library - Snackbar使用
- Android Design Support Library - TabLayout的用法
- Android Design Support Library的简单使用
- 解决 SnackBar 在 Design Support Library 23.0.0 上的滑动问题
- 测试一下博客
- 为macbook双系统的windows装驱动
- OpenStack ironic发送物理机SEL信息到Ceilometer
- 哈希表操作改进
- 一道初中数学题
- Design Support Library中Snackbar控件的简单用法
- springmvc3传相同属性值的解决
- cf 543A 完全背包
- dos系统和unix系统的文件格式区别
- 【编译原理龙书笔记】(三)词法分析(附联系答案)(仍未完成)
- 2015.6.14
- java中静态代码块的用法 static用法详解
- git学习笔记
- hadoop常见错误