---
title: "android4.0自定义标题报错  -----断点记录"
author: "zengyan2012"
date: "2013-01-30T15:05:01Z"
tags: []
categories: ["移动开发"]
slug: "android4-0"
draft: false
lastmod: "2013-01-30T15:05:01Z"
id: 1779772
url: "https://zengyan2012.iteye.com/blog/1779772"
---

1：AndraoidMainfest中 activity的样式设置 android:theme="@android:style/Theme.NoTitleBar"

  2：代码部分

requestWindowFeature(Window.FEATURE\_CUSTOM\_TITLE);  //会与 android:theme="@android:style/Theme.NoTitleBar"冲突，只能存在一个

setContentView(R.layout.activity\_dataentering);

getWindow().setFeatureInt(Window.FEATURE\_CUSTOM\_TITLE,

R.layout.top\_title);

 

解决办法：

1：androidMainfest中activity的样式设置为 android:theme="@style/android:Theme.Light"

2:代码

            requestWindowFeature(Window.FEATURE\_CUSTOM\_TITLE);  

setContentView(R.layout.activity\_dataentering);

getWindow().setFeatureInt(Window.FEATURE\_CUSTOM\_TITLE,

R.layout.top\_title);