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" ...
随机推荐
- python连接redis002
例子001. 通过StrictRedis模式连接到redis.并调用get命令读取了一个string类型的值. #!/usr/bin/python #!coding:utf-8 import redi ...
- CRAHNs: Cognitive radio ad hoc networks
2009 Elsevier 综述了认知无线AD Hoc网络中的各个方面的研究进展及面临的挑战.包括传输层.网络层.链路层的协议设计. 根据CCC(common control channel)的实现思 ...
- Jquery基础之事件操作
事件是用户操作时页面或页面加载时引发的用来完成javascript和HTML之间的交互操作.常见的元素点击事件.鼠标事件.键盘输入事件等,较传Javascript 相比JQuery增加并扩展了基本的事 ...
- POSIX和SYSTEM的消息队列应该注意的问题
首先看看POSIX的代码: 1.posix_mq_server.c #include <mqueue.h>#include <sys/stat.h>#include <s ...
- poj 1940 Wine Trading in Gergovia_贪心
在一条街上有许多房屋,每间屋子里都住着人,并且都是做葡萄酒生意的商人,他们每天都要决定买卖多少瓶葡萄酒.有趣的地方是,供需总是完美地一致.商人总是能买到自己需要的葡萄酒,并且,他们从来不介意是从哪个商 ...
- poj 1276 Cash Machine_多重背包
题意:略 多重背包 #include <iostream> #include<cstring> #include<cstdio> using namespace s ...
- KMP算法java实现
/** * 假设现在文本串S匹配到 i 位置,模式串P匹配到 j 位置 如果j = -1,或者当前字符匹配成功(即S[i] == * P[j]),都令i++,j++,继续匹配下一个字符: 如果j != ...
- 各种浏览器兼容篡位的css样式写法
谷歌浏览器的识别 @media screen and (-webkit-min-device-pixel-ratio:0) { height:10px; } IE6特制识别的 *HTML .Searc ...
- 启动Tomcat自动加载(运行)类
其实这是紧跟着我上次写的java计时器Timer的,因为Timer的测试类写好后,不可能要通过什么东西去触发,对已经存在的时间点进行监控 所以,在启动项目是自动运行此类 方法如下: 一.在web.xm ...
- c#中 HttpContext作用(一)【转】
HttpContext 主要作用是要获得你客户端向服务端请求提交的相关信息 HttpContext 类:封装有关个别 HTTP 请求的所有 HTTP 特定的信息.也有人叫上下文信息. 1.生存周期 ...