2012-12-10 4 views
2

를 만듭니다나는이 오류가 과거를 얻을 수없는 것 AndroidRuntimeException

android.util.AndroidRuntimeException: You cannot combine custom titles with other title features

나는 실행하고 API> 다음과 같이 14

매니페스트는 다음과 같습니다

<activity 
     android:name=".activity.ActivityWelcome" 
     android:label="@string/app_label_name" 
     android:launchMode="singleTask" 
     android:clearTaskOnLaunch="true" 
     android:theme="@style/My.Theme"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

나의 활동은 다음과 같습니다 :

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 
    setContentView(R.layout.welcome); 
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title_main); 
    ... 

R.layout.window_title_main은 어디에 : 다른 사람을 위해 작동하는 것 같다 왜이

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/layout_title" 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_vertical" 
    android:paddingLeft="5dp" > 

    <TextView 
     android:id="@+id/textview_title" 
     android:drawableLeft="@null" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:ellipsize="marquee" 
     android:marqueeRepeatLimit="-1"/> 

</LinearLayout> 

작동하지 않습니다?

+0

는 http://stackoverflow.com/a/8634785/603233를 참조 [Window.FEATURE를 사용하려고의 –

+0

가능한 중복 \ _CUSTOM \ _title하지만 예외를 가지고 : 당신은 다른 제목 기능을 사용하여 사용자 정의 제목을 결합 할 수 없습니다. .] (http://stackoverflow.com/questions/2686556/try-to-use-window-feature-custom-titl e- but-got-exceptionyou-can-combine-cust) –

답변

6

이것은 정신 이상으로 몰아가는 종류의 오류입니다.

부모 테마로 Theme.Holo을 사용하고 있습니다. (내 자신의 테마 확장 주제)

문서는 말한다 :

...the action bar is included in all activities that use the Theme.Holo theme (or one of its descendants), which is the default theme when either the targetSdkVersion or minSdkVersion attribute is set to "11" or greater.

http://developer.android.com/guide/topics/ui/actionbar.html#Adding (first paragraph)

좋아, 그래서 위의 과정을 통해 이동하려고 할 때 (내 질문) 나는 오류 얻을 :

You cannot combine custom titles with other title features

기본적으로 작업 표시 줄은 이미 설정되어 있으며 사용자 정의 제목 표시 줄을 사용할 수 없기 때문입니다.

문서는 "각 활동은 작업 표시 줄을 포함한다"고 밝혀 :

This way, when the application runs on Android 3.0 or greater, the system applies the holographic theme to each activity, and thus, each activity includes the action bar.

그래서, 지금 작업 표시 줄이 아닌 제목 표시 줄을 변경 내 시간을 집중할 것!

+0

당신은 saviour입니다. –

2

FEATURE_CUSTOM_TITLE

<item name="android:windowNoTitle">true</item> 

는 mutially 배타적입니다. 제거

<item name="android:windowNoTitle">true</item> 

다시 작동합니다.

+0

그래, 방금 변경했지만 변경되지 않았습니다. 나는 또한 이것을 반영하기 위해 나의 질문을 업데이트했다. – HGPB

+0

활동 선언은 어떻게 생겼습니까? –

+0

나는 이상한 일을하지 않고있다 ... (위 업데이트) – HGPB

0

초급자로서 대부분의 답변이 내 경우에 도움이되지 못했습니다. 그래서 여기 내 대답입니다.

는 당신의 안드로이드 프로젝트에 폴더를 값/고해상도로 가서 스타일을 가지고 있는지 여부 자원 태그 검사에서 strings.xml의에 대한 파일 내부 (이 파일이 귀하의 경우 다를 수 있습니다 themes.xml 같은 뭔가)

을 확인 태그.당신이 그것을 찾을 수없는 경우

뭔가 이미 스타일 태그가있는 경우

<resources> 
    <style name="SomeNameHere"> 
     <item name="android:windowNoTitle">true</item> 
    </style> 
</resources> 

, 당신의 스타일에 아래의 코드를 추가 아래처럼 자원 태그에 자식으로 아래에 언급 한 바와 같이 아래의 코드를 추가 태그

<item name="android:windowNoTitle">true</item> 
관련 문제