2

在此处输入图像描述

我想显示这样的图像,就像堆叠在一起一样,我如何动态地实现这种类型的设计

4

2 回答 2

2

请使用此代码:-

 <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:contentDescription="@string/app_name"
            android:src="@drawable/image_1" />
        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:layout_marginStart="-50dp"
            android:contentDescription="@string/app_name"
            android:src="@drawable/image_2" />
    
        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:layout_marginStart="-50dp"
            android:contentDescription="@string/app_name"
            android:src="@drawable/image_3" />
        <ImageView
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:layout_marginStart="-50dp"
            android:contentDescription="@string/app_name"
            android:src="@drawable/image_4" />
    </LinearLayout>
于 2020-09-26T06:16:59.647 回答
0

例如,将 leftmargin 设置为 -16dp 或图像宽度的 1/4

于 2020-09-26T05:57:26.727 回答