2015-03-21 2 views
0

Я создал настраиваемую строку заголовка для одного из моих экранов и пытаюсь использовать ту же концепцию в других, но получаю android.util.AndroidRuntimeException: вы не можете комбинировать собственные заголовки с другими функциями заголовка ,не может комбинировать пользовательские заголовки с другими функциями заголовка

Требование:

enter image description here

styles.xml:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="titleBarHeading" parent="@android:style/TextAppearance"> 
     <item name="android:textSize">17sp</item> 
     <item name="android:textStyle">bold</item> 
     <item name="android:textColor">#444444</item> 
    </style> 
     <style name="CustomWindowTitleBarBG"> 
      <item name="android:background">#323331</item> 
     </style> 
     <style name="TitleBarTheme" parent="android:Theme"> 
      <item name="android:windowTitleSize">35dip</item> 
      <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBarBG</item> 
    </style> 
</resources> 

manifest.xml:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.loginscreen" 
    android:versionCode="1" 
    android:versionName="1.0" > 
    <uses-sdk 
     android:minSdkVersion="8" 
     andrid:targetSdkVersion="17" /> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     > 
     <activity 
      android:name="com.example.x.sampleapp.MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name="com.example.x.sampleapp.ItemActivity" 
      /> 
     <activity 
      android:name="com.example.x.sampleapp.ReminderActivity" 
      android:theme="@style/TitleBarTheme" >  </activity> 
    </application> 
</manifest> 

Java Класс:

public class ReminderActivity extends Activity { 
    Context context; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 
     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.reminderlayout); 
     context=this; 
     ArrayList<GetReminder> list = (ArrayList<GetReminder>) getIntent().getSerializableExtra("reminderList"); 
     System.out.println("size is >>>"+list.size()); 

    } 
} 

даже я добавил <item name="android:windowActionBar">false</item> видеть другие сообщения

ответ

0
public class ReminderActivity extends Activity { 
    Context context; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.reminderlayout); 
     context=this; 
     ArrayList<GetReminder> list = (ArrayList<GetReminder>) getIntent().getSerializableExtra("reminderList"); 
     System.out.println("size is >>>"+list.size()); 

    } 
} 

Раствор для моего поста

Удаление requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); от активности и добавляющие label проявляться в деятельности, как это:

<activity 
    android:name="com.example.sheetal.sampleapp.ItemActivity" 
    android:label="ss" 
    android:theme="@style/TitleBarTheme" />