Flipping CardView in RecyclerView

I am trying to implement a CardView flash card in RecyclerView. I just can't figure out a simple solution. I have a working CardView where I can display a list of cards using a recycler view. The problem is how to show the back of the map if the user has clicked the map. I want to animate and change the front of the card to the back of the card. Can someone give a simple animation and example of a map layout. My current example is pretty much a copy of this example where a new activity is created. Where do I need a map to flip 180 degrees and show a description. Is this a way to achieve this?

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

      

+3


source to share


2 answers


You can use ViewFlipper . This is a standard Android widget.



0


source


I know this is an old question, but this answer may help someone in the future.

You can use this library

https://github.com/sachinvarma/EasyFlipView

Put this in your gradle,

compile 'com.github.sachinvarma: EasyFlipView: 2.0.4'



xml will look like

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

      

You can see the demo gif here .

Thanks to Wajahat karim.

0


source







All Articles