原文地址:
https://stackoverflow.com/a/29536902
https://stackoverflow.com/a/27754099
[your_layout.xml]
<android.support.v7.widget.Toolbar
<!-- leave the theme stuff out of here -->
style="@style/MyToolbarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
Styles / Themes in styles.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- your other attributes -->
<!-- following is used to tint the checkbox - purple for demo purpose -->
<item name="colorControlNormal">#2196F3</item>
</style>
<style name="MyToolbarStyle">
<item name="android:minHeight">?actionBarSize</item>
<item name="android:background">?colorPrimary</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="theme">@style/MyToolbarTheme</item>
</style>
<style name="MyToolbarTheme">
<!-- Used to tint the back arrow, menu and spinner arrow -->
<item name="colorControlNormal">#FFF</item>
</style>
Result
Note: I made the checkbox purple for demo purpose
-----------------------------------------------------------
Change arrow color of Spinner
1) In styles.xml, add the following style:
<style name="ActionBarThemeOverlay" parent="">
<item name="android:textColorPrimary">#ffffff</item>
<item name="colorControlNormal">#ffffff</item>
<item name="colorControlHighlight">#ff33b5e5</item>
</style>
<style name="Widget.MyTheme.HeaderBar.Spinner" parent="Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:theme">@style/ActionBarThemeOverlay</item>
</style>
2) In the layout, where you use the Spinner (in your case with Toolbar), add the style to your spinner:
<Spinner
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_spinner"
style="@style/Widget.MyTheme.HeaderBar.Spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
分享到:
相关推荐
监听列表滚动来隐藏或显示Toolbar与浮动按钮,博主账号:gaoxiaoweiandy
对于已经被不大好用的Actionbar折磨的开发者来说,Toolbar的出现确实是一个好消息,Toolbar是应用的内容的标准工具栏,可以说是Actionbar的升级版,两者不是独立关系,要使用Toolbar还是得跟ActionBar有关系的。...
VB6.0通过ImageList加载资源文件的ICO设置给ToolBar中的按钮
DrawerLayout + Toolbar 与主题theme 颜色设置
MFC工具栏ToolBar按钮添加下拉菜单
3. Toolbar ActionBar 右侧Menu添加角标(Toolbar ActionBar Menu添加小红点) 源代码在文章末尾。 ——————————————————————————– 效果预览 自定义Menu后不影响原生MD的任何效果。可以...
vs2010 CMFCToolBar 工具栏 如何修改背景颜色
此示例为在Eclipse上运行的AppBar,是通过继承ToolBar制作的简单Actionbar。
VC++ 继承自CToolBar的类,可以再toolBar按钮上显示文字,支持256色的真彩图片。 很好看,。
自己搞开发,简单状态栏适配和...在第二张效果图里,是没有遮罩View的,之后在代码文件中设置toolbar的颜色,和监听事件 toolbar.toolbarTextViewTitle.text = 搜索 toolbar.background = ColorDrawable(Color.parse
主要介绍了Android中ActionBar和ToolBar添加返回箭头的实例代码,需要的朋友可以参考下
toolbar-button, Android材质折叠工具栏的工具栏按钮库 Android工具栏按钮库在折叠工具栏上锚定浮动操作按钮的问题是CTA在滚动时被隐藏。 库允许你在工具栏中自动添加一个按钮,在工具栏隐藏自身时立即使用动画。...
pb toolbar 设置字体 pb toolbar 设置字体 pb toolbar 设置字体
比ActionBar更优秀的ToolBar使用实例 [注:本内容来自网络,在此分享仅为帮助有需要的网友,如果侵犯了您的权利,麻烦联系我,我会第一时间删除,谢谢您。]
Toolbar与ActionBar最大的区别就是Toolbar更加自由、可控。这也是Google在逐渐使用Toolbar替换ActionBar的原因,要使用Toolbar必须引入appcompat-v7支持,并设置主题为NoActionBar。
alv去掉多余按钮 alv去掉多余按钮 alv去掉多余按钮
博客文章示例代码 见文http://blog.csdn.net/kannimad/article/details/47312773
如何往IE工具条添加按钮 Adding Toolbar Buttons往IE上添加工具条 用VC在IE浏览器的工具条上添加命令按钮.zip
在ToolBar工具栏居中添加自定义控件。
TransparentToolBar 一个简单随着滚动控件滚动,不断改变颜色透明度的ToolBar