无法将自定义标题与其他标题功能结合起来

问题描述:

我了解错误告诉我的是什么,但我不知道我可以使用什么,它考虑了我试图与自定义标题结合使用的标题功能。无法将自定义标题与其他标题功能结合起来

inspection_title.axml

<?xml version="1.0" encoding="utf-8"?> 
    <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/inspectionTitle" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:ellipsize="marquee" 
    android:marqueeRepeatLimit="-1"/> 

LiftInspection.cs

[Activity(ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait)] 
public class LiftInspection : ExpandableListActivity 
{  
    protected override void OnCreate(Bundle bundle) 
    { 
     base.OnCreate(bundle); 

     string callInfo = Intent.GetStringExtra("CallInfo");   

     RequestWindowFeature(WindowFeatures.CustomTitle); 
     SetContentView(Resource.Layout.LiftInspection); 
     Window.SetFeatureInt(WindowFeatures.CustomTitle, Resource.Layout.inspection_title); 

     TextView title = (TextView) FindViewById(Resource.Id.inspectionTitle); 
     title.Text = callInfo; 
    } 

没有在清单或任何没有额外的标题定制。什么可能与CustomTitle结合生成此异常?

+2

你有没有解决问题 ?我面临同样的情况:( – kinghomer 2012-10-30 10:39:13

试试这个方法:

final Window window = getWindow(); 
boolean useTitleFeature = false; 
if(window.getContainer() == null) { 
    useTitleFeature = window.requestFeature(Window.FEATURE_CUSTOM_TITLE); 
} 
    SetContentView(Resource.Layout.LiftInspection); 
if (useTitleFeature) { 
    window.setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.inspection_title); 
} 
+3

和以前一样的结果 – jmease 2012-04-03 14:16:10

检查在AndroidManifest.xml中,如果你的主题名称为“AppTheme”,如果是这样尝试将其更改为任何其他,这是奇怪,但它帮助我

+0

奇怪,但为我工作,我把它改为@android:style/Theme – Trung 2013-03-30 09:18:32