android toolbar overflow icon color
来源:互联网 发布:windows 守护进程 编辑:程序博客网 时间:2024/06/06 21:42
/** * Change android toolbar overflow icon color * @param activity:activity * @param color:your want to color * @link http://stackoverflow.com/questions/26997231/android-lollipop-material-design-overflow-menu-icon-color */ public static void setOverflowButtonColor(final Activity activity, final int color) { final String overflowDescription = activity.getString(R.string.abc_action_menu_overflow_description); final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); if (decorView==null)return; final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver(); if (viewTreeObserver==null)return; viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { final ArrayList<View> outViews = new ArrayList<View>(); decorView.findViewsWithText( outViews, overflowDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION); if (outViews.isEmpty()) { return; } try { AppCompatImageView overflow = (AppCompatImageView) outViews.get(0); if (overflow != null) { overflow.setColorFilter(color); } if (Build.VERSION.SDK_INT < 16) { decorView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { decorView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } } catch (Exception e) { } } }); }
link:
http://stackoverflow.com/questions/26997231/android-lollipop-material-design-overflow-menu-icon-color
0 0
- android toolbar overflow icon color
- menu item icon in toolbar overflow menu
- Android Toolbar作为ActionBar时更改Title和Overflow Icon的颜色
- Toolbar 设置OverFlow 图片
- NavigationView + toolbar navigation icon
- sencha toolbar color test
- statusbar toolbar color
- android设置toolbar的menu itemTextView颜色 set toolbar menu item text color
- Toolbar menu item 显示icon
- Android - toolbar 优化 title修改边距和navigation icon修改padding值
- Android官方设计常用icon以及color颜色RGB值和对应颜色效果图
- Toolbar上overflow的样式自定义详解
- Toolbar中Overflow Menu不显示问题
- Adding new icon to toolbar with script
- 关于toolbar的menu显示icon问题
- Android Toolbar
- android ToolBar
- android toolbar
- flask + MongoDB 学习笔记 (-1): 个人用记录
- 阅读程序3
- JSONObject
- PHP审计-RIPS
- 阅读程序4
- android toolbar overflow icon color
- Javaweb乱码解决
- C#中的delegate和event
- 阅读程序5
- 初学hadoop之一:相似度计算(余弦距离)
- 动物这样叫
- flask + MongoDB 学习笔记(3):Register & Hashpassword & Login & Logout
- 华为2016实习笔试编程题--生日礼物
- Python正则表达式指南