Android 相对布局:底部布局与上方布局之间的差异
我已经阅读了关于相对布局的这两个属性的文档,并尝试了一些示例,但仍然没有认识到它们之间的区别。我试过一些测试,但通常我的结果是相同的,有时是不同的,但我无法解释 以下是关于Android文档的描述:Android 相对布局:底部布局与上方布局之间的差异,android,android-layout,android-relativelayout,Android,Android Layout,Android Relativelayout,我已经阅读了关于相对布局的这两个属性的文档,并尝试了一些示例,但仍然没有认识到它们之间的区别。我试过一些测试,但通常我的结果是相同的,有时是不同的,但我无法解释 以下是关于Android文档的描述: android:layout_above Positions the bottom edge of this view above the given anchor view ID. Accommodates bottom margin of this view and top margin of
android:layout_above
Positions the bottom edge of this view above the given anchor view ID. Accommodates bottom margin of this view and top margin of anchor view.
android:layout_alignBottom
Makes the bottom edge of this view match the bottom edge of the given anchor view ID. Accommodates bottom margin.
谢谢:)
此视图的下边缘是引用视图的上边缘的位置
android:layout_alignBottom
此视图
的底边是被引用的视图
s底边
android:layout_alignBottom
如果您想看到它的实际效果,我建议将gravity=“center”
(而不是layout\u gravity
-这是有区别的)添加到RelativeLayout
,这样第一个视图将居中,第二个视图将放在第一个视图的上方或同一位置。使用android:layout\u-toRightOf
使它们不重叠。此图解释了一切:)
上图:视图的下边缘放置在视图A的上边缘上
alignBottom:视图的底边与视图B位于同一直线上
android:layout_above :
在简单的登录页面。用户id编辑文本是上面的布局
到密码编辑文本
android:layout_alignBottom
标签用户id和用户id编辑文本正在使用android:layout\u alignBottom
图像超过1000个字。fGeorView,尝试使用两个TextView
s和A
与B
重叠。试试看。。。