我使用下面的XML文件進行自定義標題欄:的Android定製標題欄正在與一些問題
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:text="custom title bar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background" />
而且我活動的onCreate()我有以下代碼中:
public class CustomTitleBar extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
}
}
標題欄沒有問題。我設置爲背景的圖像(圖像名稱也是背景,因爲您可以在上面的xml中看到)也正在出現。但是問題出現在圖像的左右兩側留下一點空隙,即圖像沒有覆蓋父母的整個寬度layout_width已被設置爲「fill_parent」。
任何任何idea.plz幫助。
請檢查您的鏈接是唯一的這個問題的鏈接。 –
@AndroidKiller請檢查現在..錯誤的鏈接張貼 – Venky