【问题标题】:Flipping CardView in RecyclerView在 RecyclerView 中翻转 CardView
【发布时间】:2015-07-09 18:19:41
【问题描述】:

我正在尝试在 RecyclerView 中实现 CardView 翻转。我只是想不出一个简单的解决方案。我有一个可用的 CardView,我可以在其中使用回收站视图显示卡片列表。问题是,如果用户点击卡片,如何显示卡片的背面。我想使用动画并将卡片的正面更改为卡片的背面。有人可以给出卡片布局的简单动画和示例。 我当前的示例几乎是此example 的副本,其中正在创建一个新活动。我需要卡片翻转 180 度并显示说明。有办法实现吗?

+------------------+ +------------------+
|+----------------+| |+----------------+|
||  front         || ||  back          ||
|+----------------+| |+----------------+|
|+----------------+| |+----------------+|
||  front         || ||  front         ||
|+----------------+| |+----------------+|

【问题讨论】:

  • 没有人应该为你做这件事。 Read this

标签: android android-listview xamarin android-recyclerview android-cardview


【解决方案1】:

我知道这是一个老问题,但这个答案可能会对将来的人有所帮助。

你可以使用这个库

https://github.com/sachinvarma/EasyFlipView

把这个放在你的gradle里面,

编译'com.github.sachinvarma:EasyFlipView:2.0.4'

xml 会是这样的,

<com.wajahatkarim3.easyflipview.EasyFlipView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:flipOnTouch="true"
    app:flipEnabled="true"
    app:flipDuration="400"
    app:flipType="vertical" //horizontal or vertical
    >

    <!-- Back Layout Goes Here -->
    <include layout="@layout/flash_card_layout_back"/>

    <!-- Front Layout Goes Here -->
    <include layout="@layout/flash_card_layout_front"/>

</com.wajahatkarim3.easyflipview.EasyFlipView>

你可以看到一个演示 gif here

感谢 Wajahat karim。

【讨论】:

    【解决方案2】:

    您可以使用ViewFlipper。这是一个标准的 Android 小部件。

    【讨论】:

      猜你喜欢
      • 2019-03-23
      • 2021-03-23
      • 1970-01-01
      • 1970-01-01
      • 2015-12-28
      • 1970-01-01
      • 1970-01-01
      • 2021-09-26
      • 1970-01-01
      相关资源
      最近更新 更多