0
可能重複:
Set custom title bar in PreferenceAcivityPreferanceActivity和自定義標題欄。
是否有可能增加對preferancActivity自定義標題欄?
可能重複:
Set custom title bar in PreferenceAcivityPreferanceActivity和自定義標題欄。
是否有可能增加對preferancActivity自定義標題欄?
public class Preferences extends PreferenceActivity {
protected TextView title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main_tab);
title = (TextView) findViewById(R.id.titleTvLeft);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);
this.title.setText("Value");
}
}
///////在title_bar.xml ///////
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout01"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
fill_parent="" >
<TextView
android:id="@+id/titleTvLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="3dp"
android:textColor="#FFFFFF"
android:textStyle="bold" >
</TextView>
</RelativeLayout>
是的,這是可能的。 – 2012-08-06 05:12:11
我試過了,我可以顯示標題欄,但標題欄內的視圖不可見。我在哪裏可以在活動中顯示相同的標題欄 – Kamalone 2012-08-06 05:18:05