布局顶部的图像

Image on top of a layout

我需要在布局顶部显示图像,就像上面 link 中显示的图像一样。谁能帮帮忙

将顶层容器设为 RelativeLayout,并添加 rectangle viewgroup 作为子容器。

要在该特定位置显示图像,请将其 center_horizontallyalign _top 与矩形对齐,并给出它是负的上边距 ( margin_top= -halfOfImageHeight/2 )

我建议您使用相对布局,以便轻松地将图像放置在您想要的位置。

Android 的旧版本使用 xml 实体顺序来管理元素提升。 这意味着您只需将图像放在 xml 文件中的布局之后。

在较新的 Android 版本中,有一个海拔属性:http://developer.android.com/reference/android/view/View.html#attr_android:elevation

请post你xml代码了解更多详情。