微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 如何在main.xml中插入list.xml文件

有人帮我做下面的事!
我想在main.xml文件底部插入一些list list.xml文件.怎么实现呢?

   ----------------------------
    |    main.java              |
    |    main.xml               |
    |                           |
    |                           |
    |                           |
    |                           |
    |      ______               |
    |     |button|              |
    |                           |
    |                           |
    |                           |
    | _________________________ | 
    | |      list.java        | |
    | |      list.xml         | |
    | |                       | |
    | |                       | |
    | |                       | |
    | |                       | |
    | |                       | |
    |_|_______________________|_| 

I called list.java by using intent on the main.java .I also include list.xml to main.xml. When I press button list.xml should pop up like above figure. But list.xml comes up new window. How to solve this problem?

解决方法:

由于您想重新使用布局,即在其他布局中包含现有布局,我建议您阅读本文:Re-using Layouts with <include/>.

现在,您希望在main.xml中包含list.xml,请写入< include />在main.xml里面如下:

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。