首页 > 解决方案 > android图像水平堆叠在一起

问题描述

在此处输入图像描述

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

标签: androidstacktindercard

解决方案


请使用此代码:-

 <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>

推荐阅读