2012-04-03 44 views
5

Tôi hiểu lỗi nào đang nói với tôi, nhưng tôi không biết tôi có thể sử dụng gì để xem xét các tính năng tiêu đề mà tôi đang cố gắng kết hợp với Tiêu đề tùy chỉnh.Không thể kết hợp tiêu đề tùy chỉnh với các tính năng tiêu đề khác

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; 
    } 

Không có tùy biến tiêu đề bổ sung trong manifest hoặc bất cứ điều gì. Điều gì có thể kết hợp với CustomTitle để tạo ngoại lệ này?

+2

Bạn có giải quyết vấn đề ? Tôi đang đối mặt với cùng một: ( – kinghomer

Trả lời

0

thử cách này:

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

Kết quả tương tự như trước đây. – jmease

3

séc trong AndroidManifest.xml nếu tên của chủ đề của bạn là "AppTheme", nếu có cố gắng thay đổi nó với bất kỳ khác, nó là lạ nhưng nó đã giúp tôi

+0

Lạ nhưng làm việc cho tôi. Tôi đã đổi thành @android: style/Theme – Trung

Các vấn đề liên quan