android – 将RelativeLayout分成两半

android – 将RelativeLayout分成两半,第1张

概述嗨我创建了一个包含2个按钮,一个单选按钮和一个图表视图的RelativeLayout. 我想现在在图表中显示两个不同的数据. 如何将RelativeLayout分成两半? 这是我目前的XML代码: <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/ 嗨我创建了一个包含2个按钮,一个单选按钮和一个图表视图的relativeLayout.

我想现在在图表中显示两个不同的数据.

如何将relativeLayout分成两半?

这是我目前的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">    <button        androID:ID="@+ID/BtnStart"        androID:layout_wIDth="100dip"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_margintop="5dip"        androID:text="SlaveEnable" />    <button        androID:ID="@+ID/BtnStop"        androID:layout_wIDth="100dip"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_margintop="5dip"        androID:layout_toRightOf="@ID/BtnStart"        androID:text="Slavedisable" />    <Radiobutton        androID:ID="@+ID/BtnSavefile"        androID:layout_wIDth="100dip"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_toRightOf="@ID/BtnStop"        androID:text="Savefile" />    <helog.diwesh.NugaBest.GraphVIEw        androID:ID="@+ID/gvIEw"        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:layout_above="@ID/BtnStart"        androID:layout_alignParentRight="true" /></relativeLayout>
解决方法 试试这个布局.如果不完美,这应该适用于一些变化.这将添加两个图表.
<?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">    <button        androID:ID="@+ID/BtnStart"        androID:layout_wIDth="100dip"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_margintop="5dip"        androID:text="SlaveEnable" />    <button        androID:ID="@+ID/BtnStop"        androID:layout_wIDth="100dip"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_margintop="5dip"        androID:layout_toRightOf="@ID/BtnStart"        androID:text="Slavedisable" />    <Radiobutton        androID:ID="@+ID/BtnSavefile"        androID:layout_wIDth="100dip"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"        androID:layout_toRightOf="@ID/BtnStop"        androID:text="Savefile" /><linearLayout         androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"            androID:layout_above="@ID/BtnStart"            androID:layout_alignParentRight="true"        androID:orIEntation="vertical"     androID:weightSum="2" >    <helog.diwesh.NugaBest.GraphVIEw                androID:ID="@+ID/gvIEw1"                androID:layout_height="0dp"                androID:layout_wIDth="match_parent"        androID:layout_weight="1" />    <helog.diwesh.NugaBest.GraphVIEw                androID:ID="@+ID/gvIEw2"                androID:layout_height="0dp"                androID:layout_wIDth="match_parent"        androID:layout_weight="1" /></linearLayout></relativeLayout>
总结

以上是内存溢出为你收集整理的android – 将RelativeLayout分成两半全部内容,希望文章能够帮你解决android – 将RelativeLayout分成两半所遇到的程序开发问题。

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

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

原文地址: https://outofmemory.cn/web/1134542.html

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

发表评论

登录后才能评论

评论列表(0条)

保存