22
A
回答
29
使用包括標籤
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<!-- Header -->
<include
android:id="@+id/container_header_lyt"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_above=...
android:layout_toLeftOf=...
layout="@layout/header_logo_lyt" //Name of the xml layout file you want to include
/>
...
</RelativeLayout>
5
您應該使用<包括>標籤:Re-using Layouts with
11
你有一個<合併申報你的「身體」 XML佈局>標籤來使用<包括>標籤您的主要佈局。
<?xml version="1.0" encoding="utf-8"?>
<merge>
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="center"
android:src="@drawable/image"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:background="#AA000000"
android:textColor="#ffffffff"
android:text="Some Text"/>
</merge>
這是你<的內容包括>標籤
相關問題
- 1. 安卓:在XML
- 2. 擴展XHTML包括其他XML架構(XSD)
- 3. 從XML訪問其他XML?
- 4. 包括XML佈局
- 5. 包括XML文檔
- 6. 轉換XML到對象的XStream(安卓)
- 7. 安卓:XML解析問題
- 8. 解析XML XmlPullParser安卓
- 9. 安卓主題在XML
- 10. 安卓:SAX解析XML
- 11. 安卓:DOM-模型XML
- 12. 安卓:從其他活動
- 13. 安卓:其他應用
- 14. 導出到XML,包括嵌入類
- 15. struts2.xml - 不能包含其他.xml文件
- 16. Xpath的,其中包括考慮到這種XML屬性
- 17. 包括XML架構一旦
- 18. 包括其他文件到project.clj
- 19. CMake和包括其他makefiles
- 20. git - 包括其他項目
- 21. 包括其他模板
- 22. XML替換內容到其他
- 23. 如何分析包含在Java中(安卓)XML字符串
- 24. 解析XML科特林安卓
- 25. Xamarin XML安卓的onClick回調方法
- 26. 安卓保存的xml數據
- 27. 安卓導航欄大小在xml
- 28. 安卓:添加.XML資源數組
- 29. 不能到我的XML轉換爲其他XML
- 30. 對其他XML目錄值
它與RelativeLayout的工作嗎? – Xetoxyc 2011-06-10 13:25:34
我還沒有嘗試過使用RelativeLayout,但它應該。可能你必須在include標籤中設置設置放置位置的屬性:android:layout_above,android:layout_toLeftOf等... – 2011-06-10 13:34:16
它不爲我工作與實際佈局可能我的錯誤是其他地方生病的帖子我的代碼 – Xetoxyc 2011-06-10 13:38:46