Android UI ActionBar功能-自定义 Action Bar 样式
2015-10-04 22:18
543 查看
ActionBar的样式官方提供了三种:
Theme.Holo.Light
Theme.Holo.Light.DarkActionBar
但不仅仅是这三种,我们还可以自己定义ActionBar的样式:
官方帮助文档地址:http://wear.techbrood.com/training/basics/actionbar/styling.html
比如让ActionBar显示一个纯色的背景图片:
首先导入文件:
他是一个点9PNG类型的文件,可以使中间无限伸展而不变型,在AndroidUI
布局动画-点九PNG技术 中有说明;
然后在values/下新建一个themes.xml文件,自定义ActionBar样式:
然后在AndroidManifest.xml文件中将应用程序的主题更改为我们自定义的主题:
Theme.Holo
Theme.Holo.Light
Theme.Holo.Light.DarkActionBar
但不仅仅是这三种,我们还可以自己定义ActionBar的样式:
官方帮助文档地址:http://wear.techbrood.com/training/basics/actionbar/styling.html
比如让ActionBar显示一个纯色的背景图片:
首先导入文件:
他是一个点9PNG类型的文件,可以使中间无限伸展而不变型,在AndroidUI
布局动画-点九PNG技术 中有说明;
然后在values/下新建一个themes.xml文件,自定义ActionBar样式:
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="CustomActionBarTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/MyActionBar</item> </style> <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"> <item name="android:background">@drawable/actionbar_background</item> </style> </resources>注:自定义的ActionBar必须继承自官方默认提供的三种主题中的一种;
然后在AndroidManifest.xml文件中将应用程序的主题更改为我们自定义的主题:
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/CustomActionBarTheme" >
相关文章推荐
- Android UI ActionBar功能-自定义 Action Bar 样式
- UGUI学习笔记5——官方教程Drag And Drop练习
- hdu 5496 Beauty of Sequence 组合数学
- UIMenuController的使用
- Android UI ActionBar功能-在 Action Bar 上添加按钮
- Android UI ActionBar功能-在 Action Bar 上添加按钮
- UITableViewCell
- iOS编程-------UITextField UIButton UITextFieldDelegate
- Android UI ActionBar功能-启动ActionBar
- Android UI ActionBar功能-启动ActionBar
- iOS编程-------UIView
- 我写了一个高并发的BlockingQueue,有兴趣的可以看看
- mysql query cache用法与性能详细介绍
- FreeSWITCH安装报错“You must install libyuv-dev to build mod_fsv”的解决方案
- UI课程14 标签视图控制器 UITabBarController
- iOS编程------UILabel
- hdoj 5496 Beauty of Sequence 【求序列所有子序列(去重后)的和】【好题】
- valueOf intValue parsetInt区别
- Handler、Message、MessageQueue、Looper关系及源码分析
- UI课程12 模态viewController,单例及单例模式