Android 在相对布局中放置按钮

Android 在相对布局中放置按钮,android,android-layout,android-xml,Android,Android Layout,Android Xml,我有一些按钮贴在版面的底部。我想把它们添加到版面中,并给它们加上背景。我怎样才能做到这一点?我试了很多,但都做不到 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content">

我有一些按钮贴在版面的底部。我想把它们添加到版面中,并给它们加上背景。我怎样才能做到这一点?我试了很多,但都做不到

<RelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <in.wptrafficanalyzer.graphicspickimageviewcanvas.PaintView
                android:id="@+id/paint_view"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_above="@+id/btn_pick"  />
            <Button
                android:id="@+id/btn_pick"
                android:layout_width="90dp"
                android:layout_height="55dp"
                android:text="pick"
                android:layout_marginLeft="50dp"
                android:layout_marginStart="45dp"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true" />
            <Button
                android:id="@+id/save"
                android:layout_width="90dp"
                android:layout_height="55dp"
                android:text="save"
                android:layout_alignParentBottom="true"
                android:layout_toRightOf="@+id/btn_pick"
                android:layout_toEndOf="@+id/btn_pick"
                android:layout_marginLeft="45dp"
                android:layout_marginStart="45dp" />

        </RelativeLayout>

为了这个,它们被粘在了底部

        <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <in.wptrafficanalyzer.graphicspickimageviewcanvas.PaintView
            android:id="@+id/paint_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_above="@+id/btn_pick"  />
  <RelativeLayout
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:background="#25348C"                 android:layout_height="wrap_content">
        <Button
            android:id="@+id/btn_pick"
            android:layout_width="90dp"
            android:layout_height="55dp"
            android:text="pick"
            android:layout_marginLeft="50dp"
            android:layout_marginStart="45dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />
        <Button
            android:id="@+id/save"
            android:layout_width="90dp"
            android:layout_height="55dp"
            android:text="save"
            android:layout_alignParentBottom="true"
            android:layout_toRightOf="@+id/btn_pick"
            android:layout_toEndOf="@+id/btn_pick"
            android:layout_marginLeft="45dp"
            android:layout_marginStart="45dp" />
       </RelativeLayout>
    </RelativeLayout>

我知道你不知道,所以删除那一行,如果那不是答案,你可以发布一张图片(模型)的两个,你有和你想要的布局,这样我们可以帮助你

编辑: android:background=“#25348C”这应该可以:

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <in.wptrafficanalyzer.graphicspickimageviewcanvas.PaintView
            android:id="@+id/paint_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_above="@+id/buttonWrapper"  />

      <LinearLayout
           android:id="@+id/buttonWrapper"
           android:orientation="horizontal"
           android:background="@color/yourcolor"
           android:layout_height="wrap_content"
           android:layout_width="match_parent"
           android:layout_alignParentBottom="true">
        <Button
            android:id="@+id/btn_pick"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="pick"
            android:layout_marginLeft="50dp"
            android:layout_marginStart="45dp" />
        <Button
            android:id="@+id/save"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="save"
            android:layout_marginLeft="45dp"
            android:layout_marginStart="45dp" />
        </LinearLayout>
    </RelativeLayout>


只要用颜色为你的颜色提供一些东西。xml

尝试删除android:layout_over=“@+id/btn_pick”@JCodex,如果我删除我的服装视图,它就会跳过按钮。问题不清楚,我认为自定义视图就是你的背景如果你想让自定义视图成为背景,试着在xml中的按钮之后放置自定义视图。这可能会让你觉得你想在相对布局中有一个单独的背景吗?如果是这样的话,当你尝试的时候会发生什么。这个问题很难理解。我知道它们为什么会粘在一起。我想粘在底部。我只想将这两个按钮添加到相对布局中,以设置背景。