[英]how to use views declared in one layout xml file in other layout
Respected All, I am newly working on android technology. 尊敬的所有人,我正在研究android技术。 I have use map view which is declared in another layout.I have to display in some part of may screen.
我使用了在另一种布局中声明的地图视图。我必须在五月屏幕的某些部分中显示。 can I use same map view or i have to create new mapview programmatically.
我可以使用相同的地图视图,还是必须以编程方式创建新的地图视图? In short i have to display map in some part of my screen.
简而言之,我必须在屏幕的某些部分显示地图。 How can i do it.. Thank You (Vikram Kadam)
我该怎么办..谢谢(维克拉姆·卡丹)
You need to use the tag <include>
. 您需要使用标签
<include>
。 From the google documentation : 从Google文档中:
<com.android.launcher.Workspace
android:id="@+id/workspace"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
launcher:defaultScreen="1">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
<include android:id="@+id/cell3" layout="@layout/workspace_screen" />
</com.android.launcher.Workspace>
You can find a full explanation in the documentation. 您可以在文档中找到完整的说明。
我将在XML文件中定义视图,然后每次需要时,都可以从XML文件中扩展视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.