android-RelativeLayout视图重叠

android-RelativeLayout视图重叠,第1张

概述所需的布局是标题,下面有两个框架(稍后将包含片段),并且按钮固定在屏幕底部:HeaderText----------------------frame1|frame2----------------------btn1btn2btn3我几乎完成了这种排序(最后是xml),有一个问题…两个框架重叠在按钮上.我已经对该

所需的布局是标题,下面有两个框架(稍后将包含片段),并且按钮固定在屏幕底部:

     header Text     ----------------------frame 1   |  frame 2----------------------btn 1   btn 2   btn 3

我几乎完成了这种排序(最后是xml),有一个问题…两个框架重叠在按钮上.

我已经对该问题进行了一些搜索,发现this,但是所有的 *** 作都将我的问题从按钮溢出的帧更改为标题溢出的帧.

我还尝试将按钮设置为显示在框架下方,而不是与父级底部对齐,但这只是将其推离屏幕.

当前布局xml:

<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent"    androID:orIEntation="vertical" >    <TextVIEw            androID:ID="@+ID/fdname"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:layout_alignParenttop="true"            androID:clickable="true"            androID:gravity="center"            androID:text="No department info has been entered yet"            androID:textSize="25dp" />    <TextVIEw            androID:ID="@+ID/fdaddress"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:layout_below="@ID/fdname"            androID:gravity="center"            androID:text="address"            androID:textSize="15dp" />    <TextVIEw            androID:ID="@+ID/horizontalline"            androID:layout_wIDth="match_parent"            androID:layout_height="2dip"            androID:layout_below="@ID/fdaddress"            androID:background="#ff23cf"            androID:gravity="center_vertical"            androID:paddingBottom="2dip"            androID:paddingtop="2dip" />    <linearLayout            androID:ID="@+ID/frames"            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:layout_below="@ID/horizontalline"            androID:orIEntation="horizontal" >            <FrameLayout                    androID:ID="@+ID/leftpane"                    androID:layout_wIDth="0px"                    androID:layout_height="match_parent"                    androID:layout_weight="1" />            <TextVIEw                    androID:ID="@+ID/verticalline"                    androID:layout_wIDth="2dp"                    androID:layout_height="match_parent"                    androID:background="#ff23cf"                    androID:gravity="center_horizontal"                    androID:paddingleft="5dip"                    androID:paddingRight="5dip" />            <FrameLayout                    androID:ID="@+ID/rightpane"                    androID:layout_wIDth="0px"                    androID:layout_height="match_parent"                    androID:layout_weight="1" >            </FrameLayout>    </linearLayout>    <linearLayout            androID:ID="@+ID/buttons"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:layout_alignParentBottom="true"            androID:gravity="center"            androID:orIEntation="horizontal" >            <button                    androID:ID="@+ID/EventVIEwbutton"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:gravity="center"                    androID:minHeight="25dp"                    androID:text="@string/menu_event_vIEw"                    androID:textSize="15dp"                     androID:layout_weight="1">            </button>            <button                    androID:ID="@+ID/MemberVIEwbutton"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:gravity="center"                    androID:minHeight="25dp"                    androID:text="@string/menu_member_vIEw"                    androID:textSize="15dp"                     androID:layout_weight="1">            </button>            <button                    androID:ID="@+ID/AttendanceVIEwbutton"                    androID:layout_wIDth="wrap_content"                    androID:layout_height="wrap_content"                    androID:gravity="center"                    androID:minHeight="25dp"                    androID:text="@string/menu_atnd_vIEw"                    androID:textSize="15dp"                     androID:layout_weight="1">            </button>    </linearLayout></relativeLayout>

解决方法:

尝试在包含框架的linearLayout之前声明包含按钮的linearLayout,并保留androID:layout_alignParentBottom =“ true”属性.

然后,向您的框架容器中添加上述约束:

androID:layout_below="@ID/horizontalline"androID:layout_above="@ID/buttons"

这种方式应强制将帧作为最后一帧绘制在屏幕上,从而填充剩余的空间.

希望它能起作用!

总结

以上是内存溢出为你收集整理的android-RelativeLayout视图重叠全部内容,希望文章能够帮你解决android-RelativeLayout视图重叠所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1084738.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存