android – 如何使用RelativeLayout实现以下结果?

android – 如何使用RelativeLayout实现以下结果?,第1张

概述图片: http://img838.imageshack.us/img838/1402/picse.png 如何在Pic中进行布局. 2仅使用RelativeLayout.下面是第一个屏幕截图的xml布局. <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.and 图片: http://img838.imageshack.us/img838/1402/picse.png

如何在Pic中进行布局. 2仅使用relativeLayout.下面是第一个屏幕截图的xml布局.

<?xml version="1.0" enCoding="utf-8"?><relativeLayout        xmlns:androID="http://schemas.androID.com/apk/res/androID"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"><TextVIEw    androID:ID="@+ID/timer_textvIEw"    androID:layout_wIDth="fill_parent"    androID:layout_height="wrap_content"    androID:gravity="center"    androID:layout_margintop="10dip"    androID:textSize="30sp"    androID:layout_alignParenttop="true"    androID:text="@string/timer_start" /><ListVIEw     androID:ID="@+ID/questions_ListvIEw"    androID:layout_below="@ID/timer_textvIEw"      androID:layout_wIDth="wrap_content"    androID:layout_height="fill_parent" /><button androID:ID="@+ID/true_btn"    androID:text="@string/true_option"    androID:layout_alignParentBottom="true"    androID:layout_weight="1"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content" /><button    androID:ID="@+ID/false_btn"    androID:text="@string/false_option"    androID:layout_toRightOf="@ID/true_btn"    androID:layout_alignBaseline="@ID/true_btn"    androID:layout_weight="1"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content" /></relativeLayout>
解决方法 您可以在底部使用linearLayout来实现此目的.但是你只想使用relativeLayout布局:
<relativeLayout androID:layout_wIDth="fill_parent" ... >...    <VIEw androID:ID="@+ID/helper" androID:layout_wIDth="0dp"androID:layout_height="0dp" androID:layout_alignParentBottom="true"androID:layout_centerHorizontal="true" /><button androID:ID="@+ID/true_btn"androID:layout_alignParentBottom="true"androID:layout_alignParentleft="true"androID:layout_wIDth="wrap_content"androID:layout_height="wrap_content" androID:layout_toleftOf="@ID/helper"/><buttonandroID:ID="@+ID/false_btn"androID:layout_alignBaseline="@ID/true_btn"androID:layout_alignParentRight="true"androID:layout_wIDth="wrap_content"androID:layout_height="wrap_content" androID:layout_toRightOf="@ID/helper" /></relativeLayout>

你真的不能使用嵌套布局吗?

总结

以上是内存溢出为你收集整理的android – 如何使用RelativeLayout实现以下结果?全部内容,希望文章能够帮你解决android – 如何使用RelativeLayout实现以下结果?所遇到的程序开发问题。

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

    保存