2011-04-26 43 views

回答

0

您可以使用include tagviewstub甚至fragments

下面介紹如何使用include達到你想要

  1. 創建描述您的工具欄佈局文件,例如什麼toolbar.xml
  2. 在你希望你的工具欄會出現在每個XML佈局文件添加include標記指向您的toolbar.xml

例子:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="fill_parent" android:layout_width="fill_parent"> 
    <include android:id="@+id/titleBar" layout="@layout/title_bar" 
     android:layout_width="fill_parent" android:layout_height="48dip" /> 
    <!-- All the rest of your activity layout below --> 
</RelativeLayout> 
+0

ü可以給演示的例子? – user725753 2011-04-26 17:36:19

+0

當然,我延長了我的答案 – Bostone 2011-05-18 18:09:39

相關問題