2011-04-26 25 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

相关问题