Android UI ActionBar功能-自定义 Action Bar 样式
ActionBar的样式官方提供了三种:
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 样式的更多相关文章
- Android UI ActionBar功能-在 Action Bar 上添加按钮
在ActionBar上添加按钮实现某些功能最常见的Application的功能如:在ActionBar上添加一个搜索按钮: 首先官方文档说明:http://wear.techbrood.com/tra ...
- Android UI ActionBar功能-自定义Tab功能
还可以使用ActionBar实现Tab选项卡功能: 官方帮助文档:http://wear.techbrood.com/training/basics/actionbar/styling.html#Cu ...
- Android UI ActionBar功能-启动ActionBar
官方帮助文档:http://wear.techbrood.com/training/basics/actionbar/index.html ------------------------------ ...
- Android UI ActionBar功能-自动隐藏 Action Bar
为了使ActionBar不影响Activity的布局内容,我们还可以设置ActionBar,将其设置为透明,并且让Activity是头部自动空出一个ActionBar的空间: 官方文档:http:// ...
- Android UI ActionBar功能-Action Bar 左上角的向上或返回按钮
ActionBar在左上角还提供了一个向上或返回的按钮,默认情况下是隐藏的需要在代码中开启: 官方文档:http://wear.techbrood.com/training/basics/action ...
- Android UI ActionBar功能-ActionBarSherlock 的使用
ActionBarSherlock实现了在ActionBar上添加一个下拉菜单的功能,也是App常用的功能之一: ActionBarSherlock是第三方提供的一个开源类库,下载地址:http:// ...
- Android UI ActionBar功能-ActionBarProvider的使用
分享功能是很多App都有一个功能,ActionBarProvider可以实现分享功能: 3.0以前的版 本和3.0以后的版 本的区别: public class MainActivity extend ...
- Android系统UI交互控件Action Bar初探
过年期间,Google正式宣布取消Android系统中MENU键的使用,也就是基于Android 4.0系统的手机都应没有MENU这一固定按键.这无疑是个变革性的改动,在我眼中,这似乎把Android ...
- [Android UI] ActionBar 自定义属性
actionbar 默认放在顶部, 如果在application或者activity中加入 android:uiOptions="splitActionBarWhenNarrow" ...
随机推荐
- hightchart or hightstock 格式Y数据
hightchart or hightstock 格式Y数据,鼠标放在上面显示两位小数 方法一: tooltip: { shared: true, crosshairs: true , formatt ...
- SharedPreference对象及其xml文件
SharedPreferences对象----->getXXX SharedPreferences.Editor对象---->putXXX
- KnockOutJS学习系列----(一)
原文地址:http://www.cnblogs.com/n-pei/archive/2011/12/23/2299217.html 好几个月没去写博客了,最近也是因为项目紧张,不过这个不是借口,J. ...
- Linux内核中常见内存分配函数(二)
常用内存分配函数 __get_free_pages unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) __get_f ...
- 浅谈C语言中的强符号、弱符号、强引用和弱引用
摘自http://www.jb51.net/article/56924.htm 浅谈C语言中的强符号.弱符号.强引用和弱引用 投稿:hebedich 字体:[增加 减小] 类型:转载 时间:2014- ...
- 窥探 kernel --- 进程调度的目标,nice值,静态优先级,动态优先级,实时优先级
http://blog.chinaunix.net/uid-24227137-id-3595610.html 窥探 kernel --- 进程调度的目标,nice值,静态优先级,动态优先级,实时优先级 ...
- hdu 5620 KK's Steel(推理)
Problem Description Our lovely KK has a difficult mathematical problem:he has a N(1≤N≤1018) meters s ...
- hdu 4686 Arc of Dream(矩阵快速幂乘法)
Problem Description An Arc of Dream is a curve defined by following function: where a0 = A0 ai = ai- ...
- IKAnalyzer使用停用词词典进行分词
@Test // 測试分词的效果,以及停用词典是否起作用 public void test() throws IOException { String text = "老爹我们都爱您.&qu ...
- 2014 ACM省赛总结
今年ACM省赛已经过去一个星期左右了,2年的ACM训练是该做个总结了,因为前几日去參加蓝桥杯总决赛,所以没来的及写总结,如今在这小小总结一下吧-- 依晰记得去年省赛时候的样子,如今感觉那时像是个无知的 ...