土拨鼠1号 2022-05-11 17:04 采纳率: 60%
浏览 52
已结题

Android-Activity如何将背景图片置顶



```xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background" >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        android:layout_gravity="center_horizontal|top"
        android:layout_weight=".7" >
    // 其它元素
    // .......
    </FrameLayout>
</LinearLayout>

描述:
我现在有个Activity,是LinearLayout布局,设置了它的背景图片,它里面有个FrameLayout布局的子元素,这个子元素里还有其它的控件。
问题:
如何让这个background背景图片置顶(位于所有子元素的上面,因为这个背景图片是镂空的,我只需要显示这部分就行了)

  • 写回答

2条回答 默认 最新

  • love. 2022-05-11 18:21
    关注

    搞个笨方法,activity用相对布局,然后在最后面加个imageview,铺满、加上背景就ok了

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 8月23日
  • 创建了问题 5月11日