In this article, you will learn how to create a new Xamarin Android flip card animation between fragments using Gesture Event.
Let’s start,
Step 1: Open Visual Studio->New Project->Templates->Visual C#->Android->Blank App
Select blank app. Give the Project Name and Project Location.
Step 2: Next to Create Card_Front.axml page, go to Solution Explorer-> Project Name->Resources->Layout. Right click to Add-> New Item, open new Dialog box.
Step 3: This dialog box is required to select Android Layout and give the Name for Card_Front.axml.Step 4: Open Solution Explorer-> Project Name-> Resources-> Layout-> Main.axml. Click to open Design View. Give the following code:XAML Code
Step 5: Open Solution Explorer-> Project Name-> Resources-> layout->Card_Front.axml. Click to open Design View.
Step 6: Select toolbar, drag and drop ImageView Design.AXML Code
Step 7: Open MainActivity.cs page, create Gesture variable.
GestureDetector gesturedetector;
Step 8: Within the Oncreate(), declare gesture event and Fragment transaction.
Step 9: After Oncreate(), create new class CardFrontFragment.C# Code
Step 10: Below CardFrontFragment.class, create one more new class for MyGestureListener. Here, we define the gesture by click event, DoubleClick(), scroll(), LongPress(), OnFling().
C# Code
Step 11: Debug and run the app.
Xamarin.Forms For Beginners