How to show a loading gif while an APi is being called in xamarin android?

You can do it like this:

private void BtnConsumer_Click(object sender, EventArgs e)
{
    CustomProgressDialog progressDialog = CustomProgressDialog.Show(this);
    try
    {
        String cpfConsumer = edtCpf.Text;
        Pessoa pessoa = this.GetConsumer(cpfConsumer);
        List<String> lista = this.GetServiceOrders(cpfConsumer);
        txtnome.Text = "Nome: " + pessoa.firstName + " " + pessoa.lastName;
        ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, lista);
        mlistview.Adapter = adapter;
    catch (Exception ex)
    {
        Toast.MakeText(this, "EXCEPTION: " + ex.Message, ToastLength.Long).Show();
    }
    progressDialog.Dismiss();
}

private Pessoa GetConsumer(String cpfConsumer)
{
    // API Consumer CPF
    RestClient client = new RestClient("https://qa.api-latam.whirlpool.com/v1.0/consumers");
    RestRequest requestConsumer = new RestRequest("/" + cpfConsumer, Method.GET);
    requestConsumer.AddHeader("Content-Type", "application/json; charset=utf-8");
    requestConsumer.AddHeader("Authorization", "Bearer fed6b2f0-7aba-3339-9813-7fc9387e2581");
    IRestResponse responseConsumer = consumer.Execute(cpfConsumer);
    Pessoa pessoa = JsonConvert.DeserializeObject<Pessoa>(responseConsumer.Content);
    return pessoa;
}

private List<String> GetServiceOrders(String cpfConsumer)
{
    // API Consumer service-orders
    RestClient client = new RestClient("https://qa.api-latam.whirlpool.com/v1.0/consumers/");
    RestRequest ordersRequest = new RestRequest("/" + cpfConsumer + "/service-orders", Method.GET);
    ordersRequest.AddHeader("Content-Type", "application/json; charset=utf-8");
    ordersRequest.AddHeader("Authorization", "Bearer fed6b2f0-7aba-3339-9813-7fc9387e2581");
    IRestResponse ordersResponse = client.Execute(requestorderId);
    RootObject ordersObject = JsonConvert.DeserializeObject<RootObject>(ordersResponse.Content);

    List<String> lista = new List<String>();
    for (int i = 0; i < ordersObject.orders.Count; i++)
    {
        String s = ordersObject.orders[i].order.orderId + " " + "StatusCode" + " - " + ordersObject.orders[i].order.orderStatusCode + " " + "Status Description: " + " - " + ordersObject.orders[i].order.orderStatusDescription;
        lista.Add(s);
    }
}

Then you need to create the CustomProgressDialog.cs with the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace App4.Dialogs
{
    public class CustomProgressDialog
    {
        private CustomProgressDialog() { }

        public static Dialog Show(Context context)
        {
            Dialog dialog = new Dialog(context, Android.Resource.Style.ThemeTranslucentNoTitleBar);
            dialog.SetContentView(Resource.Layout.custom_progress_dialog);
            dialog.Window.SetGravity(GravityFlags.Center);
            dialog.SetCancelable(true);
            dialog.CancelEvent += delegate { dialog.Dismiss(); };
            dialog.Show();
            return dialog;
        }
    }
}

In the Resources/Layout folder, create the custom_progress_dialog.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/progres"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_gravity="center"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:background="#000000" >
  <ProgressBar
      android:indeterminate="true"
      style="?android:attr/progressBarStyleLarge"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_margin="20dp"
      android:layout_centerInParent="true"
      android:indeterminateDrawable="@drawable/custom_progress_bar" />
</RelativeLayout>

In the Resources/Drawable folder, create the custom_progress_bar.xml:

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:pivotX="50%" 
    android:pivotY="50%" 
    android:fromDegrees="0"
    android:toDegrees="360">
  <shape android:shape="ring" android:innerRadiusRatio="3"
      android:thicknessRatio="8" android:useLevel="false">
    <size 
        android:width="76dip" 
        android:height="76dip" />
    <gradient 
        android:type="sweep" 
        android:useLevel="false"
        android:startColor="@android:color/transparent"
        android:endColor="#00FF00"
        android:angle="0" />
  </shape>
</rotate>