zoukankan      html  css  js  c++  java
  • Android开发如何在4.0及以上系统中自定义TitleBar

    4.0系统以上自定义标题栏报错解决办法:

    1、为布局文件修改style.xml

    此处的style.xml在values-11或者value-14中,否侧会报错:you cannot combine custom titles with other title features

    <?xml version="1.0" encoding="utf-8"?>
    <resources xmlns:android="http://schemas.android.com/apk/res/android">
    
        <style name="CustomizedWindowTitleBackground">
            <item name="android:background">#047BF0</item>
        </style>
    
        <style name="titlebarstyle" parent="android:Theme">
            <item name="android:windowTitleSize">55dp</item>
            <item name="android:windowTitleBackgroundStyle">@style/CustomizedWindowTitleBackground</item>
            <!-- All customizations that are NOT specific to a particular API-level can go here. -->
        </style>
    
    </resources>
    

      2、在AndroidManifest.xml添加主题样式

    android:theme="@style/titlebarstyle"

     <activity
                android:name="com.gnnuit.mobilesafe.ui.TaskManagerActivity"
                android:label="@string/task_manager"
                android:theme="@style/titlebarstyle" >
            </activity>
  • 相关阅读:
    几个函数小练习
    结构体和枚举类型
    结构体
    几个函数小练习
    函数简介
    网页端滚轮滑动事件
    碰撞检测
    Ajax前后台交互函数
    事件绑定与解除js
    移动端的屏幕适配问题
  • 原文地址:https://www.cnblogs.com/FlySheep/p/3574804.html
Copyright © 2011-2022 走看看