我理解错误告诉我的内容,但我不知道我可以使用它认为标题功能我正在尝试与自定义标题结合。
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结合生成此异常?
答案 0 :(得分:3)
检查AndroidManifest.xml,如果你的主题名称是“AppTheme”,如果是这样,尝试将其更改为任何其他,这很奇怪,但它帮助了我
答案 1 :(得分:0)
尝试这种方式:
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);
}