Setting a Window.FEATURE_CUSTOM_TITLE creates AndroidRuntimeException
android
Solution
This is the kind of error that will drive you to insanity and beyond.
So I happen to be using `Theme.Holo` as my parent theme. (The theme that my own theme extends)
The documentation says:
...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)
Ok, so when I try to go through the process above (my question) I get the error:
You cannot combine custom titles with other title features
Well, that's because, by default action bar is setup already and it won't allow you to use a custom title bar as well.
Documentation reveals that "each activity includes the action bar":
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.
So, I will now focus my time on altering the action bar and not the title bar!
Problem
I can't seem to get past this error: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features I am running API > 14. Manifest is as follows: ``` <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> ``` My activity is doing the following: ``` @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); ... ``` Where `R.layout.window_title_main` is: ``` <?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> ``` Why is this not working when it seems to work for others?