<合并>的简单例子和<包括>在 Android XML 布局中的使用 [英] Simple example of <merge> and <include> usage in Android XML-layouts

查看:36
本文介绍了<合并>的简单例子和<包括>在 Android XML 布局中的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇 Android XML 布局中的 <merge><include> 标签.我已经阅读了两篇教程,但还没有找到一个简单的示例用法.

I'm curious about the <merge> and <include> tags in Android XML-layouts. I've read two tutorials, but haven't yet found a simple example usage.

如果有人能提供这样的例子或指点一下,我会很高兴.

Would be happy if someone could provide such an example or give a pointer to one.

推荐答案

some_activity.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical">

    // some views

    <include layout="@layout/view_part"/>

   // probably more views

</LinearLayout>

view_part.xml:

<merge xmlns:android="http://schemas.android.com/apk/res/android">

    // the views to be merged

</merge>

这篇关于&lt;合并&gt;的简单例子和&lt;包括&gt;在 Android XML 布局中的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆