【问题标题】:swiping card in xamarin (visual studio) for android like google cards in maps/news在 xamarin (visual studio) 中刷卡,如地图/新闻中的谷歌卡
【发布时间】:2017-01-22 11:17:03
【问题描述】:

下面是我的应用程序布局,我已经包含了卡片视图。但无法让它像地图/新闻中的谷歌卡一样刷卡。

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="8dp">
        <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:id="@+id/card_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            card_view:cardCornerRadius="8dp"
            android:elevation="2dp"
            card_view:cardBackgroundColor="@color/orange">
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/white"
                android:id="@+id/contenLayout">
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/imgSource"
                    android:layout_centerInParent="true"
                    android:scaleType="fitXY"
                    android:src="@drawable/image" />
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/mytextview"
                    android:textSize="20sp"
                    android:layout_alignParentBottom="true"
                    android:textColor="@color/content"
                    android:background="@color/orange"
                    android:gravity="center_horizontal"
                    android:paddingBottom="5dp"
                    android:paddingTop="5dp"/>
            </RelativeLayout>
        </android.support.v7.widget.CardView>
    </LinearLayout>

我需要在每次刷卡时加载不同的数据。与屏幕的简单触摸事件不同,刷卡是可逆的。
当我从左到右或从右到左刷卡时,下一张卡应该是可见的。我还在 xamarin 论坛上查看了解决方案,发现 xcardview 仅适用于 IOS。

【问题讨论】:

  • 根据您的描述,您是否要求水平的RecyclerView?如果没有,您能否展示一张图片告诉我们您想要实现的目标?
  • 感谢 Grace,但我在 Xamarin 论坛上找到了解决方案。实际上我试图实现类似于 ViewPager 和 Carousel View 的功能。 forums.xamarin.com/discussion/3174/… 下面是 Cheesebaron 在 Git 上的非常好的示例 github.com/Cheesebaron/ViewPagerIndicator

标签: c# android visual-studio xamarin.android cardview


【解决方案1】:

我在 Xamarin 论坛上找到了解决方案。实际上我试图实现类似于 ViewPager 和 Carousel View 的功能。以下是关于 ViewPager 的讨论链接。

https://forums.xamarin.com/discussion/3174/viewpager-example-with-android-4-0

下面是 Cheesebaron 在 Git 上的非常好的示例代码 https://github.com/Cheesebaron/ViewPagerIndicator

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-18
    • 2021-03-19
    • 2012-08-02
    • 2014-08-24
    • 1970-01-01
    相关资源
    最近更新 更多