android– 布局问题.如何在顶部布置1个图像视图,在底部布置1个图像

android– 布局问题.如何在顶部布置1个图像视图,在底部布置1个图像,第1张

概述我有一个垂直的LinearLayout.我想在顶部布置1个ImageView,在LinearLayout的底部布置1个ImageView.我尝试在每个ImageView中放置’android:gravity=“top”’和’android:gravity=“bottom”’,但两个ImageView都出现在LinearLayout的顶部.有办法解决吗?谢谢.<LinearLayout

我有一个垂直的linearLayout.我想在顶部布置1个ImageVIEw,在linearLayout的底部布置1个ImageVIEw.我尝试在每个ImageVIEw中放置’androID:gravity =“top”’和’androID:gravity =“bottom”’,但两个ImageVIEw都出现在linearLayout的顶部.有办法解决吗?

谢谢.

   <linearLayout        androID:orIEntation="vertical"        androID:layout_wIDth="wrap_content"        androID:layout_height="fill_parent">   <ImageVIEw        androID:ID="@+ID/button1"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:src="@drawable/icon"        androID:gravity="top" />   <ImageVIEw        androID:ID="@+ID/button2"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:src="@drawable/icon"        androID:gravity="bottom" />   </linearLayout>
@H_502_10@解决方法:

最简单的方法是使用relativeLayout.用relativeLayout替换你的linearLayout并更改第一个ImageVIEw使用androID:layout_alignParenttop =“true”,第二个使用androID:layout_alignParentBottom =“true”.

总结

以上是内存溢出为你收集整理的android – 布局问题.如何在顶部布置1个图像视图,在底部布置1个图像全部内容,希望文章能够帮你解决android – 布局问题.如何在顶部布置1个图像视图,在底部布置1个图像所遇到的程序开发问题。

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存