Android RelativeLayout:如何将视图放在另一个视图上方,而不必触及?

Android RelativeLayout:如何将视图放在另一个视图上方,而不必触及?,第1张

概述我正在显示一个可以包含任意行数的ListView.我希望ListView包装内容.我还希望一些文本位于屏幕的底部,无论列表的大小如何.像这样:我尝试实现这一点的方法如下,但是当内容很大时,它会使其看起来像左下角的图像.<RelativeLayoutxmlns:android="http://schemas.android.com/apke

我正在显示一个可以包含任意行数的ListVIEw.我希望ListVIEw包装内容.我还希望一些文本位于屏幕的底部,无论列表的大小如何.像这样:

我尝试实现这一点的方法如下,但是当内容很大时,它会使其看起来像左下角的图像.

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent"    androID:orIEntation="vertical"    androID:background="@color/blue">    <TextVIEw        androID:ID="@+ID/fine_print"        androID:layout_wIDth="fill_parent"        androID:layout_height="wrap_content"        androID:layout_alignParentBottom="true"          androID:layout_below:"@+ID/table"        androID:gravity="center_horizontal"      />    <ListVIEw         androID:ID="@+ID/table"         androID:layout_wIDth="fill_parent"         androID:layout_height="wrap_content"        androID:background="@drawable/white_Box">    </ListVIEw></relativeLayout>

并添加

androID:layout_above="@ID/fine_print"

到@ ID / table使它看起来像右下角的图像.

我怎样才能做到我想要的呢?

解决方法:

这看起来有点奇怪,但这是我如何运作的.由于底部的文本大小为“8dip”,并且根据屏幕方向占据1或2行,我在列表下方放置了“16dip”填充.

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent"    androID:orIEntation="vertical"    androID:background="@color/blue">    <linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"        androID:ID="@+ID/details_wrapper"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:orIEntation="vertical"        androID:paddingBottom="16dip">        <ListVIEw             androID:ID="@+ID/table"             androID:layout_wIDth="fill_parent"             androID:layout_height="wrap_content"            androID:background="@drawable/white_Box">        </ListVIEw>    </linearLayout><TextVIEw    androID:ID="@+ID/fine_print"    androID:layout_wIDth="fill_parent"    androID:layout_height="wrap_content"    androID:layout_alignParentBottom="true"      androID:gravity="center_horizontal"  /></relativeLayout>

尽管如此,仍然愿意接受关于使这种清洁工的建议

总结

以上是内存溢出为你收集整理的Android RelativeLayout:如何将视图放在另一个视图上方,而不必触及?全部内容,希望文章能够帮你解决Android RelativeLayout:如何将视图放在另一个视图上方,而不必触及?所遇到的程序开发问题。

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

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

原文地址: http://outofmemory.cn/web/1109908.html

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

发表评论

登录后才能评论

评论列表(0条)

保存