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 错误18456

    第一步. 错误发生的场景 第二步. 找到引起错误的原因 第1步. 查看windows日志文件. 运行中输入 eventvwr (event viewer)打开日志文件查看器, 第三步. 解决方案,由第 ...

  2. android关于window

    http://mobile.51cto.com/android-259922_all.htm http://mobile.51cto.com/android-259922.htm http://mob ...

  3. NetFlow

    供应商 支持的流 设备列表 Cisco NetFlow Cisco - 800.1700.2600.1800.2800.3800.4500.6500.7200.7300.7500.7600.10000 ...

  4. 对话 UNIX: 关于 inode

    http://www.ibm.com/developerworks/cn/aix/library/au-speakingunix14/ WMI http://wiki.hudson-ci.org/di ...

  5. Google地图轨迹回放模拟

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. PHP单例模式编写

    今天来点基础的设计模式: 如何利用单例模式实现一个数据库中间层 class Db{ static private $_instance; //当前数据库连接实例 static public funct ...

  7. C#中MessageBox用法总结

    我们在程序中经常会用到MessageBox. MessageBox.Show()共有21中重载方法.现将其常见用法总结如下: 1.MessageBox.Show("Hello~~~~&quo ...

  8. ORACLE表空间bigfile和smallfile

    BIGFILE | SMALLFILE Use this clause to determine whether the tablespace is a bigfile or smallfile ta ...

  9. 最基本MySQL命令及vi命令

    1.MySQL基本命令操作 Mysql的所有命令末尾都需要以分号结束,一条命令可以分成多行书写. 连接数据库:mysql –u root –p: 查看所有数据库:show databases; 创建数 ...

  10. DoNet开源项目-基于jQuery EasyUI的后台管理系统

    博主在业余时间开发了一个简单的后台管理系统,其中用到了 jQuery EasyUI 框架,上次分享过系统布局,参考文章:jQuery EasyUI 后台管理系统布局分享,目前已完成系统的整体框架的搭建 ...