自定义Titlebar时为了避免冲突

需要修改:AndroidManifest.xml

android:theme="@style/mystyle" 

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

<style name="mystyle" parent="android:Theme">
<item name="android:windowTitleSize">50dp</item>
</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. application/xml和text/xml的区别

    XML有两个MIME类型,application/xml和text/xml,它们之间的区别是: text/xml忽略xml文件头中的关于编码的设定(<?xml version="1.0 ...

  2. android ipc通信机制之之三,进程通讯方式。

    IPC通讯方式的优缺点: IPC通讯方式的对比 名称 优点 缺点 适用场景 Bundle 简单易用 只能传输Bundle支持的数据类型 四大组件的进程通信 文件共享 简单易用 不适合高并发场景,并无法 ...

  3. Mysqlbinlog使用

    Mysqlbinlog使用   1.binlog日志打开方法 在my.cnf这个文件中加一行(Windows为my.ini).#vi /etc/my.cnf[mysqld]log-bin=mysqlb ...

  4. 【转】安装Intel HAXM为Android 模拟器加速,30秒内启动完成

    http://www.cnblogs.com/Li-Cheng/p/4351966.html http://www.cnblogs.com/csulennon/p/4178404.html https ...

  5. 得到内网域管理员的5种常见方法<转>

    1.Netbios and LLMNR Name Poisoning 这个方法在WIN工作组下渗透很有用,WIN的请求查询顺序是下面三个步骤:本地hosts文件(%windir%\System32\d ...

  6. Chrome Apps将可以打包成iOS或Android应用

    Chrome Apps 将可以在 iOS 和 Android 设备上独立运行了.开发者只要使用 Google今天 提供的工具集(toolchain)将自己的 Web App 打包,并将生成的应用上传到 ...

  7. Delphi调用Dll的的2种写法

         unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, F ...

  8. 【剑指offer】近期公共祖先

    转载请注明出处:http://blog.csdn.net/ns_code/article/details/28113959 剑指offer上的最后一题了,一个递归函数调了一下午,才得到正确的结果. 题 ...

  9. MYSQL内存--------启动mysql缓存机制,实现命中率100% 转

    虽然这个标题夸张得过了头,但此文很完整,值得学习.转自 http://www.yy520.net/read.php?278 myql优化,启动MySQL缓存机制,实现命中率100% 配置你的mysql ...

  10. Anaconda packages list

    # packages in environment at D:\Applications\Anaconda3:#alabaster 0.7.6 py35_0 anaconda 2.4.0 np110p ...