【问题标题】:android image stack on top of each other horizontallyandroid图像水平堆叠在一起
【发布时间】:2021-01-12 09:27:39
【问题描述】:

我想显示这样的图像,就像在彼此顶部的堆栈中一样,我如何动态实现这种类型的设计

【问题讨论】:

    标签: android stack tinder card


    【解决方案1】:

    请使用此代码:-

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 没看懂,能不能在recycler view里实现@Alireza
      • 让我测试一下linearLayout
      猜你喜欢
      • 2018-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-11
      • 1970-01-01
      • 1970-01-01
      • 2019-01-09
      相关资源
      最近更新 更多