自定义Titlebar时为了避免冲突

需要修改:AndroidManifest.xml

  1. android:theme="@style/mystyle"

styles.xml文件中需要加上下面内容

  1. <style name="mystyle" parent="android:Theme">
  2. <item name="android:windowTitleSize">50dp</item>
  3. </style>
 
下面是网上别人的详细分析:
运行项目时,有时LogCat报错: AndroidRuntimeException: You cannot combine custom titles with other title feature

网上说,去掉AndroidManifest.xml中Activity的android:theme="@android:style/Theme.NoTitleBar.Fullscreen"属性。但我看AndroidManifest.xml 根本没有设这个值

[Java] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/TitleBarStyle">
        <activity
            android:name="com.example.b.MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action
android:name=
"android.intent.action.MAIN"/>
 
                <category
android:name=
"android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>

有可能是@style/AppTheme里面设了这个值吧?于是我再看values/styles.xml文件

4.0 即API 14,AppBaseTheme应该在values-v14/style.xml里面的

于是我再去看android:Theme.Holo.Light.DarkActionBar 

<style name="Theme.Holo.Light.DarkActionBar"> 里面没有关于类似<style name="windowNoTitle">的东西

<style name="Theme.Holo.Light">代码

太多东西了{:soso_e117:},他们引用的东西也不尽相同.....

解决方法:

后来,我直接在 AndroidManifest.xml 中,将android:theme="@style/AppTheme" 直接改成android:theme="@style/android:Theme.Light" (就是不继承API 14中的Theme,用回API 11前的Theme)

或者,删除values-v11和values-v14里面的styles.xml

 
让系统自动调用values/styles.xml

由于API-11的<style name="Theme.Holo.Light"> 和 API-14<style name="Theme.Holo.Light.DarkActionBar"> 跟API之前版本的<style name="Theme.Light"> 代码太多不同了,所以就我也不明白到底哪里出了问题

看到别人博客上还有一个解决的方案:

在style.xml中修改加入这句“ <item name="android:windowActionBar">false</item>”

  1. <style name="AppTheme" parent="AppBaseTheme">
  2. <!-- All customizations that are NOT specific to a particular API-level can go here. -->
  3. <item name="android:windowActionBar">false</item>
  4. </style>
 

转 Android 4.0后,自定义Title报错 You cannot combine custom titles with other title feature的更多相关文章

  1. android 自定义title 报错 You cannot combine custom titles with other title feat

    solution: http://www.apkbus.com/android-80416-1-1.html http://www.eoeandroid.com/forum.php?mod=viewt ...

  2. Android真机调试 Android.Util.AndroidRuntimeException: You cannot combine custom titles with other title features

    参考连接:http://blog.csdn.net/scyatcs/article/details/9003285 Android.Util.AndroidRuntimeException: You ...

  3. 解决Android Studio编译后安装apk报错:Error while Installing APK

    刚开始玩 Android ,用Android studio  连接真机做测试,在虚拟机上没有问题,但是真机就会报错 检查了好多地方,最终发现了问题,网上的常规就不介绍了,大家自己去看别的帖子 手机方面 ...

  4. 我的Android进阶之旅------>解决Android Studio编译后安装apk报错:The APK file does not exist on disk

    1.错误描述 今天用Android Studio编译应用后安装APK的时候,报错了,错误如下所示: The APK file build\outputs\apk\OYP_2.3.4_I2Base_64 ...

  5. 创建好Android Application Project 后运行就报错。

    如图: 这个问题有可能是有可能是没导入Android support库,简单了解一下: google提供了Android Support Library package 系列的包来保证来高版本sdk开 ...

  6. appium在android 7.0真机上运行报错command failed shell:............ps:'uiautomator"的解决方式

    appium版本:1_4_16 在CSDN中找到相关解决的方案,根据此解决方案顺利的解决了让人惆怅的问题,再次记录. 1.找到appium安装目录下的adb.js文件,目录为:Appium\node_ ...

  7. RN与android原生开发混合后的环境报错问题

    RN与android原生开发混合后的环境报错问题 需要先安装nodejs$ yarn --version1.12.1更新当前版本yarn upgrade --latest安装 | Yarnhttps: ...

  8. Android 6.0以后的版本报错:open failed: EACCES (Permission denied)

    Android 6.0以后的版本报错:open failed: EACCES (Permission denied) 在开发项目中,遇见要进行文件操作,遇见Caused by: android.sys ...

  9. Android版本28使用http请求报错not permitted by network security policy

    Android版本28使用http请求报错not permitted by network security policy android模拟器调试登录的时候报错 CLEARTEXT communic ...

随机推荐

  1. 乐观锁--CAS

    悲观锁与乐观锁的区别 悲观锁会把整个对象加锁占为已有后才去做操作,Java中的Synchronized属于悲观锁.悲观锁有一个明显的缺点就是:它不管数据存不存在竞争都加锁,随着并发量增加,且如果锁的时 ...

  2. zendstudio 10下载汉化

      1.文件和汉化文件 ZendStudio官方下载地址:http://www.geekso.com/component/zendstudio-downloads/ 百度云地址: 10.0.0.msi ...

  3. 如何将mysql表结构导出成Excel格式的(并带备注)

    http://www.liangchan.net/liangchan/4561.html 1.使用一个mysql管理工具:SQLyog,点击菜单栏“数据库”下拉的最后一项: 导出的格式如下: 2.要想 ...

  4. 80端口被NT kernel & System 占用pid 4

    前段时间停止了Apache,结果在打开的时候发现无法打开,80端口被占用,于是win+r 运行cmd 输入netstat -ano 可以看到80端口被PID4占用,于是打开任务管理器-进程-查看,选择 ...

  5. git 与 github 最简单的用法

    今天发现cygwin里已经装了git,所以顺便测试一下git是怎么用的. 大概最简单的用法是这样的: 1.在github创建一个repository.复制右边那个 HTTPS clone URL 2. ...

  6. PhotoShop中画圆角矩形最简单方法(图文并茂)!

    PhotoShop中画圆角矩形最简单方法(图文并茂)! 1. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZHhubjUyMA==/font/5a6L5L ...

  7. DDNS 的工作原理及其在 Linux 上的实现--转

    http://www.ibm.com/developerworks/cn/linux/1305_wanghz_ddns/index.html DDNS (Dynamic DNS) 扩展了 DNS 将客 ...

  8. python之装饰器详解

    这几天翻看python语法,看到装饰器这里着实卡了一阵,最初认为也就是个函数指针的用法,但仔细研究后发现,不止这么简单. 首先很多资料将装饰器定义为AOP的范畴,也就是Aspect Oriented ...

  9. Eclipse开发JQuery环境设置(Spket)

     http://www.cnblogs.com/sayo/archive/2008/10/20/1315528.html   首先需要安装Spket.可以参阅我的这篇文章进行Spket的安装. 之后进 ...

  10. css笔记07:通配符选择器

    通配符选择器: * { margin:10px ;//默认四个位置参数全为零 margin-top:10px;//分别设置四个参数 margin-left:10px; margin-right:0px ...