AndroidBar返回为NULL。是因为values-v11和values-v14下面的style的主题的设置的原因。

在SDK 11的设备上,会使用第二处,SDK 14会使用第三处。

只需要将三个地方的主题分别设置就可以,结构如下:

values--------

<resources>

    <!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style> <!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style> </resources>

values-v11--------

<resources>

    <!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 14 theme customizations can go here. -->
<item name="android:actionBarStyle">@style/my_actionbar_style</item>
</style> <style name="my_actionbar_style" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#ff8c00</item>
<item name="android:titleTextStyle">@style/AcBar_titleStyle</item>
<item name="android:displayOptions">showTitle</item>
</style> <style name="AcBar_titleStyle">
<item name="android:textColor">#FFFFFF</item>
<item name="android:textSize">20sp</item>
</style> <style name="AppTheme" parent="AppBaseTheme"></style>
</resources>

values-v14--------

<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
<item name="android:actionBarStyle">@style/my_actionbar_style</item>
</style> <style name="my_actionbar_style" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#ff8c00</item>
<item name="android:titleTextStyle">@style/AcBar_titleStyle</item>
<item name="android:displayOptions">showTitle</item>
</style>
<style name="AcBar_titleStyle">
<item name="android:textColor">#FFFFFF</item>
<item name="android:textSize">20sp</item>
</style>
<style name="AppTheme" parent="AppBaseTheme"></style>
</resources>
主要注意红色部分

Android ActionBar 返回为NULL的更多相关文章

  1. Android ActionBar详解

    Android ActionBar详解 分类: Android2014-04-30 15:23 1094人阅读 评论(0) 收藏 举报 androidActionBar   目录(?)[+]   第4 ...

  2. Android ActionBar完全解析,使用官方推荐的最佳导航栏(下) .

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/25466665 本篇文章主要内容来自于Android Doc,我翻译之后又做了些加工 ...

  3. Android ActionBar完全解析,使用官方推荐的最佳导航栏(上)

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/18234477 本篇文章主要内容来自于Android Doc,我翻译之后又做了些加工 ...

  4. Android ActionBar全然解析,使用官方推荐的最佳导航栏(上)

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/18234477 本篇文章主要内容来自于Android Doc.我翻译之后又做了些加工 ...

  5. 【转】Android ActionBar完全解析,使用官方推荐的最佳导航栏(上)

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/18234477 本篇文章主要内容来自于Android Doc,我翻译之后又做了些加工 ...

  6. Android ActionBar(转)

    本文内容 关于 ActionBar 必要条件 项目结构 环境 演示一:Action Bar 显示隐藏 演示二:Action Item 显示菜单选项 演示三:Action Home 启用“返回/向上”程 ...

  7. Android ActionBar应用实战,高仿微信主界面的设计

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/26365683 经过前面两篇文章的学习,我想大家对ActionBar都已经有一个相对 ...

  8. android双击返回键退出程序

    今天给大家简单说一下,android双击返回键退出程序. @Override public boolean onKeyDown(int keyCode, KeyEvent event) {      ...

  9. Android 原生 Android ActionBar

    本文内容 关于 ActionBar 必要条件 项目结构 环境 演示一:Action Bar 显示隐藏 演示二:Action Item 显示菜单选项 演示三:Action Home 启用"返回 ...

随机推荐

  1. ural 1020 Rope

    #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> # ...

  2. LinkedList和ArrayList的区别

    LinkedeList和ArrayList都实现了List接口,但是它们的工作原理却不一样.它们之间最主要的区别在于ArrayList是可改变大小的数组,而LinkedList是双向链接串列(doub ...

  3. strings和nm命令

    strings和nm命令 strings 一.简介: 显示文件中的可打印字符 二.用法 strings [option(s)] [file(s)] 选项说明: -a – –all 扫描整个文件而不是只 ...

  4. Q - Get The Treasury - HDU 3642 (扫面线求体积)

    题意:求被三个或三个以上立方体重合的体积 分析:就是平面面积的加强,不过归根还是一样的,可以把z轴按照从小向大分区间N个,然后可以得到N个平面,用平面重复三次以上的在和高度计算体积. ******** ...

  5. Gradle[0]依赖本地JAR和远程仓库JAR的配置

    1.对本地Jar的依赖配置 如果不知道Jar包的远程仓库地址,而项目中又要使用该Jar包,就需要进行本地设置. 例如,需要使用的Jar包为sigar.jar,则需要在项目根目录下建目录:libs,并把 ...

  6. mac下Apache添加限速模块mod_bw

    官方文档: Apache2 - Mod_bw v0.7 Author : Ivan Barrera A. (Bruce) HomePage : Http://Ivn.cl/apache & h ...

  7. Android软键盘强制弹出,隐藏输入法.

    本文实例讲述了Android实现弹出键盘代码,是一个非常实用的功能.代码非常简洁.分享给大家供大家参考. 具体功能代码如下: ? 1 2 3 4 5 6 7 8 Timer timer = new T ...

  8. 减少iOS应用程序安装包大小

    安装包优化大小方法: <资源优化> 1.去除无用资源 通过几次项目的升级后,项目中会出现一些没有用到的图片.这些图片在我们导入到项目中后,之后项目升级过程后并没有再次用到. 那这些图片我们 ...

  9. Android(java)学习笔记260:JNI之native方法头文件的生成

    1. JDK1.6 ,进入到工程的bin目录下classes目录下: 使用命令: javah  packageName.ClassName 会在当前目录下生成头文件,从头文件找到jni协议方法 下面举 ...

  10. js验证表单并提交

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