RelativeLayout 下的控件叠加

1. 相对布局下的空间叠加

效果图如下:
RelativeLayout 下的控件叠加_第1张图片

2.背景色+横线布局如下


<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@color/cutlineColor"/>
        shape>
    item>
    
    <item
        android:top="1px">
        <shape android:shape="rectangle">
            <solid android:color="@color/Color_jobNumber" />
        shape>
    item>


layer-list>

2. 相对布局下,实现布局叠加

"1.0" encoding="utf-8"?>
"http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    "@layout/include_head_title" />

    "@+id/load_lin_sum"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@+id/et_scan_input"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/et_scan_input"
        android:layout_gravity="center_vertical"
        android:background="@drawable/layout_bg_style_one"
        android:gravity="center"
        android:paddingBottom="@dimen/y10"
        android:paddingTop="@dimen/y10"
        android:visibility="gone">

        "wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/already_encapsulation"
            android:textColor="@color/primary"
            android:textSize="@dimen/FontSize_24" />

        "@+id/load_sum_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/x22"
            android:layout_marginRight="@dimen/x22"
            android:text="0"
            android:textColor="@color/Color_E"
            android:textSize="@dimen/FontSize_38"
            android:textStyle="bold" />

        "wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/piece"
            android:textColor="@color/primary"
            android:textSize="@dimen/FontSize_24" />

        "@+id/tv_pack_num"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/x22"
            android:layout_marginRight="@dimen/x22"
            android:text="0"
            android:textColor="@color/Color_E"
            android:textSize="@dimen/FontSize_38"
            android:textStyle="bold"
            android:visibility="gone" />

        "@+id/tv_pack_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/bundle"
            android:textColor="@color/primary"
            android:textSize="@dimen/FontSize_24"
            android:visibility="gone" />
    </LinearLayout>



    "
        android:layout_width="@dimen/x40"
        android:layout_height="@dimen/x40"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="@dimen/y15"
        android:layout_marginLeft="@dimen/x26"
        android:src="@drawable/btn_pull_up"
        android:visibility="gone" />

线性布局的背景是白色的,ImageView必须在布局的下面,这样子会先绘制线性布局,后绘制ImageView。实现叠加效果。

你可能感兴趣的:(Android)