Android开发如何在4.0及以上系统中自定义TitleBar
4.0系统以上自定义标题栏报错解决办法:
1、为布局文件修改style.xml
此处的style.xml在values-11或者value-14中,否侧会报错:you cannot combine custom titles with other title features
1
2
3
4
5
6
7
8
9
10
11
12
13
14 |
<?xml version= "1.0"
encoding= "utf-8" ?> <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>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。