【问题标题】:android: Displaying multiple images like INSIDE the Tinder-cardsandroid:显示多个图像,例如在 Tinder-cards 内
【发布时间】:2018-10-06 22:15:19
【问题描述】:

我将如何以 Tinder 的方式显示多张图像:当我单击图像的右侧时,它应该显示下一张图像,并在我单击图像的左侧时显示上一张图像。

它还应仅在单击时向右或向左显示一个小箭头,并以某种方式显示正在显示的图片(带有小条,如火种或点之类的东西)。

有图书馆吗?

编辑: 澄清一下:我已经在 Diolor/Swipecards 库的帮助下实现了 Tinder 刷卡。令人惊讶的是,我有点坚持的是实现 Tinder 刷卡卡内的图片库。只有上图中看到的部分。

【问题讨论】:

    标签: android image-gallery tinder


    【解决方案1】:

    【讨论】:

    • 感谢您的快速回复,请查看我的问题的编辑。
    • 嘿..你知道了吗?
    【解决方案2】:

    我的解决方案是添加两张箭头图片,在它们上方放置两个布局,然后为布局添加 onClickListeners,它选择适配器中的下一张/上一张图片以显示在 ImageView 中。

    布局 .xml 文件:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:clipToPadding="false"
        android:outlineProvider="bounds"
        android:paddingLeft="10sp"
        android:paddingTop="10sp"
        android:paddingRight="10sp"
        android:paddingBottom="100sp">
    
        <android.support.v7.widget.CardView
            android:id="@+id/cardView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:elevation="2dp"
            app:cardCornerRadius="4dp">
    
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:orientation="vertical">
    
    
                <ImageView
                    android:id="@+id/imageViewMainBackground"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop"
                    android:src="@mipmap/ic_user_default" />
    
                <ImageView
                    android:id="@+id/imageNext"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical|end"
                    android:scaleType="centerCrop"
                    android:src="@drawable/outline_keyboard_arrow_right_black_48" />
    
                <ImageView
                    android:id="@+id/imagePrevious"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:scaleType="centerCrop"
                    android:src="@drawable/outline_keyboard_arrow_left_black_48" />
    
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:weightSum="1">
    
                    <LinearLayout
                        android:id="@+id/previousLayout"
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_weight=".50"
                        android:orientation="horizontal" />
    
                    <LinearLayout
                        android:id="@+id/nextLayout"
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="end"
                        android:layout_weight=".50"
                        android:orientation="horizontal" />
                </LinearLayout>
    
                <TextView
                    android:id="@+id/nameTextView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:padding="20sp"
                    android:shadowColor="@color/colorBlack"
                    android:shadowRadius="20"
                    android:textColor="@color/colorWhite"
                    android:textSize="30sp"
                    tools:text="hello" />
    
                <ImageView
                    android:id="@+id/infoImageViewItemCard"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom|end"
                    android:scaleType="centerCrop"
                    android:padding="20sp"
                    android:shadowColor="@color/colorBlack"
                    android:shadowRadius="20"
                    android:src="@drawable/outline_info_white_48" />
    
                <LinearLayout
                    android:id="@+id/bottomLayout"
                    android:layout_width="match_parent"
                    android:layout_height="110dp"
                    android:layout_gravity="bottom"
                    android:orientation="horizontal" />
    
            </FrameLayout>
        </android.support.v7.widget.CardView>
    
    
    </LinearLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-03
      • 2021-02-09
      • 1970-01-01
      • 2012-05-04
      相关资源
      最近更新 更多