ActionBar的样式官方提供了三种:

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 样式的更多相关文章

  1. Android UI ActionBar功能-在 Action Bar 上添加按钮

    在ActionBar上添加按钮实现某些功能最常见的Application的功能如:在ActionBar上添加一个搜索按钮: 首先官方文档说明:http://wear.techbrood.com/tra ...

  2. Android UI ActionBar功能-自定义Tab功能

    还可以使用ActionBar实现Tab选项卡功能: 官方帮助文档:http://wear.techbrood.com/training/basics/actionbar/styling.html#Cu ...

  3. Android UI ActionBar功能-启动ActionBar

    官方帮助文档:http://wear.techbrood.com/training/basics/actionbar/index.html ------------------------------ ...

  4. Android UI ActionBar功能-自动隐藏 Action Bar

    为了使ActionBar不影响Activity的布局内容,我们还可以设置ActionBar,将其设置为透明,并且让Activity是头部自动空出一个ActionBar的空间: 官方文档:http:// ...

  5. Android UI ActionBar功能-Action Bar 左上角的向上或返回按钮

    ActionBar在左上角还提供了一个向上或返回的按钮,默认情况下是隐藏的需要在代码中开启: 官方文档:http://wear.techbrood.com/training/basics/action ...

  6. Android UI ActionBar功能-ActionBarSherlock 的使用

    ActionBarSherlock实现了在ActionBar上添加一个下拉菜单的功能,也是App常用的功能之一: ActionBarSherlock是第三方提供的一个开源类库,下载地址:http:// ...

  7. Android UI ActionBar功能-ActionBarProvider的使用

    分享功能是很多App都有一个功能,ActionBarProvider可以实现分享功能: 3.0以前的版 本和3.0以后的版 本的区别: public class MainActivity extend ...

  8. Android系统UI交互控件Action Bar初探

    过年期间,Google正式宣布取消Android系统中MENU键的使用,也就是基于Android 4.0系统的手机都应没有MENU这一固定按键.这无疑是个变革性的改动,在我眼中,这似乎把Android ...

  9. [Android UI] ActionBar 自定义属性

    actionbar 默认放在顶部, 如果在application或者activity中加入 android:uiOptions="splitActionBarWhenNarrow" ...

随机推荐

  1. SQL Server 主动防止阻塞的 1 方法

    方法 1. set lock_timeout 5000;  这里设置超时为5秒; 例子: 连接A begin tran             update dbo.TestTable        ...

  2. Git学习01 --git add, git commit , git log ,git status, git reset --hard, head

    Git官方提供的快速入门教程:https://try.github.io/levels/1/challenges/1 特点:Git极其强大的分支管理:分布式版本 集中式版本控制系统,版本库是集中存放在 ...

  3. html5 web worker

    A web worker is a JavaScript running in the background, without affecting the performance of the pag ...

  4. Noip2013之路

    当我回望过去的一年,我想,我对自己没有任何的愧疚,因为我每一个脚印,都踩的很坚实. 第一次参加模拟赛,第一次接触NOIP的规则,虽然考得不是特别好,但是还是很有收获的,首先,数组一定要开得足够大,不然 ...

  5. POJ 3368 RMQ-ST

    一直感觉RMQ水,没自己写过,今天写了一道题,算是完全独立写的,这感觉好久没有了... 一直以来,都是为了亚洲赛学算法,出现了几个问题: 1.学的其实只是怎么用算法,对算法的正确性没有好好理解,或者说 ...

  6. 函数dirname--返回路径中的目录部分

    http://blog.chinaunix.net/uid-122937-id-142880.html dirname() 函数作用   返回路径中的目录部分. 语法   dirname(path) ...

  7. Python学习入门基础教程(learning Python)--8.1 字典数据添加与删除

             1. 字典数据添加 这个很简单,像赋值那样一项项赋值即可.语法结构如下 dict_obj[key] = value 添加数据项示例如下 >>> d1 = {'cod ...

  8. android soundpool 參数说明

    SoundPool 类的构造函数例如以下: SoundPool(int maxStreams, int streamType, int srcQuality) 作用:实例化一个SoundPool 实例 ...

  9. 为什么Underscore

    Underscore是什么? Underscore一个JavaScript实用库,提供了一整套函数式编程的实用功能,但是没有扩展任何JavaScript内置对象.它是这个问题的答案:“如果我在一个空白 ...

  10. Google Map 根据坐标 获取地址信息

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.X ...