,修改Activity标题栏出错

求助,修改Activity标题栏出错小弟按照网上的说法写的代码,但是总是报错:You cannot combine custom titles

求助,修改Activity标题栏出错
小弟按照网上的说法写的代码,但是总是报错:
You cannot combine custom titles with other title features
网上说这个错误是给标题栏指定了两个title,但是我没有啊。。。。还请指教啊,下面是代码:

ChangeTitleActivity.java

Java code
package Rinder.ChangeTitle;import android.app.Activity;import android.os.Bundle;import android.view.Window;import android.view.WindowManager;public class ChangeTitleActivity extends Activity {    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);//        左侧图标显示,可以实现//        requestWindowFeature(Window.FEATURE_LEFT_ICON);//        setContentView(R.layout.main);//        getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher);                //全屏显示,不显示标题栏可以实现//        requestWindowFeature(Window.FEATURE_NO_TITLE);//        setContentView(R.layout.main);//        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);        //就是下面这句话会使用自己的title回出错            requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);        setContentView(R.layout.main);        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);    }}


一般说是在manifest里设置了Activity的theme属性可能造成这个问题。。。。。。

AndroidManifest.xml代码
XML code
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="Rinder.ChangeTitle"    android:versionCode="1"    android:versionName="1.0" >    <uses-sdk android:minSdkVersion="14" />    <application        android:icon="@drawable/ic_launcher"        android:label="@string/app_name">        <activity            android:name=".ChangeTitleActivity"             android:label="@string/app_name">            <intent-filter >                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>    </application></manifest>


其实应该是requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);这句就错了,但是还是把自定义的title贴出来
自定义的title.xml
XML code
<?xml version="1.0" encoding="UTF-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="wrap_content"    android:layout_height="wrap_content"   android:orientation="horizontal">       <ImageView android:layout_width="wrap_content"           android:layout_height="wrap_content"           android:src="@drawable/ic_launcher"        android:gravity="bottom"/>     <TextView android:id="@+id/text"           android:layout_width="wrap_content"           android:layout_height="wrap_content"           android:layout_alignParentLeft="true"           android:text="文本" />   </LinearLayout>


我想难道是我自己指定的title和他默认的冲突了?、但是requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);就是告诉系统我要使用自定义的啊??请大侠指教~~~~

[解决办法]
你这是 4.0吗 可能是布局文件的问题吗?

<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"


android:gravity="bottom"/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="文本" />
TextView android:layout_alignParentLeft="true" 但是却是在ImageView 的右边 那ImageView 放到哪里?

[解决办法]
楼主现在错误解决了吗?

我用楼主的代码在4.0和2.3的环境下面都尝试了,没有错误,标题栏的布局确实已经被修改了


[解决办法]
You cannot combine custom titles with other title features

字面意思应该就是你对一个titile设置了两个feature:
一个是Window.FEATURE_CUSTOM_TITLE
另一个呢?
[解决办法]
首先 你试试把第三句代码移到中间试试 其次 你可以试试this.requestWindowFeature(Window.FEATURE_NO_TITLE); 先写这句再写第一句 同时记得移动代码 有时候有些代码顺序是谷歌建议的 比如listview setfootview和setheadview建议放在setAdapter之前