我刚到安卓工作室..。所以我一直在尝试做一个简单的应用程序。当我想把两个线性布局放在另一个,其中一个走出了框架!我不知道我做得对不对。这里还有一些图片(第二个是问题):
1)http://i.imgur.com/2H1hOxk.jpg
2)http://i.imgur.com/5IeZHsC.jpg
谢谢
发布于 2015-08-16 16:18:18
从您的图片中,包含其他两个线性布局的父线性布局的方向设置为“水平”。必须设置为“垂直”才能凌驾于对方之上.
在父线性布局中,您会发现以下内容:
Android:orientation=“水平”
改为:
Android:orientation=“垂直”
发布于 2015-08-16 16:22:36
对于水平方向,需要将内部LinearLayout宽度设置为0dp,并将其权重设置为1。
对于真正的定向,您需要将内部LinearLayout高度设置为0dp,并将其权重设置为1。
如果没有加权属性,由于第一个LinearLayout宽度被设置为match_parent,它将占用整个LinearLayout。
示例:
在横向布局的情况下:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="0d"
android:layout_height="match_parent"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="0d"
android:layout_height="match_parent"
android:layout_weight="1">
</LinearLayout>
</LinearLayout>https://stackoverflow.com/questions/32037258
复制相似问题