Android 如何像这样布局重叠视图

Android 如何像这样布局重叠视图,android,view,Android,View,我只想布局一个重叠视图,如下所示: 我认为有两种方式来布局视图,一种是将其切割成5个部分,如下所示: 所以我们可以控制它,但它太复杂了。 另一种方法是使用framelayout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal"

我只想布局一个重叠视图,如下所示:

我认为有两种方式来布局视图,一种是将其切割成5个部分,如下所示:

所以我们可以控制它,但它太复杂了。 另一种方法是使用framelayout

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <ImageView
            android:src="@drawable/state_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <ImageView
            android:layout_marginLeft="120dp"
            android:src="@drawable/state_2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <ImageView
            android:layout_marginLeft="240dp"
            android:src="@drawable/state_3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </FrameLayout>


</LinearLayout>


但它不能完全适合所有尺寸。有人帮忙吗?

感谢adnel帮助编辑使用水平线性布局,并为所有图像视图指定
。并将每个图像视图的宽度设置为
0dp
like
android:layout\u width=“0dp”
。是的,水平线性布局会将视图分为3部分。但它无法容纳视图,因为像1和2这样的视图具有重叠区域。相对布局可以做到这一点。您可以尝试使用线性布局,并在第二和第三个视图上为
android:layout\u marginLeft
属性设置负值