在彼此的顶部布局 [英] Layouts on top of each other

查看:143
本文介绍了在彼此的顶部布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

结果
这是一个Android开发的问题。结果
然后添加使用 addContentView(布局另一个内容视图;如果我先用的setContentView(R.layout.main)设置的内容,以我的XML布局,则params),内容的看法相互重叠。我想第二个内容,以自身直属的第一个位置。它是可能的,或者我需要在XML和以某种方式编程创建布局相结合?两个布局是线性的。


This is an android development question.
If I first set the content view to my xml layout using setContentView(R.layout.main); and then add another content view using addContentView(layout, params), the content views overlap each other. I want the second content view to position itself directly under the first one. Is it possible or do I need to combine the xml and the programatically created layouts in some way? Both of the layouts are linear.

在此先感谢

推荐答案

把这两样布局内的的LinearLayout 与垂直方向。完蛋了。

Put both Layouts inside an LinearLayout with vertical orientation. thats it.

编辑:

我的意思是,你必须创建一个3布局的XML文件。

what i mean is you have to create a 3 layout xml files.


  1. 的main.xml

  2. layout1.xml - >你的第一个布局

  3. layout2.xml - >你的第二个布局

您主要布局文件,建议立即进行删除是这样的:

your main layout file shoul be like this:

<LinearLayout android:orientation="vertical">
<include android:id="+id/lay1" android:layout="@layout/layout1"/>
<include android:id="+id/lay2" android:layout="@layout/layout2"/>
</LinearLayout>

现在您的主要布局到你的的setContentView(R.layout.main)

Now your the main layout to your setContentView(R.layout.main)

这篇关于在彼此的顶部布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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