2

How to display loader image. If service is hitting, I want to display loader image in background in Xamarin.Forms.

4 Answers 4

3

Xamarin.Forms has an ActivityIndicator: http://iosapi.xamarin.com/index.aspx?link=T%3AXamarin.Forms.ActivityIndicator You'll probably find various code examples on how to use it.

If the core problem is how to load something in the background while displaying any "loading" indicator, you might look into this example: http://xforms-kickstarter.com/#asynchronous-web-requests

Sign up to request clarification or add additional context in comments.

Comments

1

Use Xamarin.Forms' ActivityIndicator. Click here for details please.

This is how I use it, you just need to create a new property in your view model and call it as IsLoading, if this is set to true, then Activity Indicator will be visible, that is all you need;

// IsLoading property in the viewmodel
  public bool IsLoading
  {
      get
      {
          return isLoading;
      }
      set
      {
          isLoading = value;
          OnPropertyChanged();
      }
  }


//code sample in xaml
  <Grid Grid.Row="1"
  IsVisible="{Binding IsLoading}"
  BackgroundColor="Black"
  Opacity="0.25">
  <Grid.RowDefinitions>
    <RowDefinition Height="1*"/>
    <RowDefinition Height="1*"/>
  </Grid.RowDefinitions>

  <ActivityIndicator  Grid.Row="0"
                      IsVisible="{Binding IsLoading}"
                      IsRunning="{Binding IsLoading}"
                      VerticalOptions="End"
                      HorizontalOptions="Center"/>
  <Label Grid.Row="1"
         Text="Please wait..."
         TextColor="White"
         VerticalOptions="Start"
         HorizontalOptions="Center"/>

</Grid>

Comments

0

Your Question is not very clear,

I guess you just mean you want to notify the user with a loading animation, while a task running in the background is taking some time?

Check http://developer.xamarin.com/recipes/ios/standard_controls/popovers/display_a_loading_message/ for a quick and easy way to implement that. The code there is quite editable so you can adapt it for your needs.

For a cross platform solution (Xamarin.Forms), you might want to look at:

Xamarin Forms show blocking loading message

2 Comments

I want in the same way,but i want to display for all three plateform android,ios and windows phone,how we can make for all three.
Answer edited - The link above should answer your question then
0

For implementation of Loader or ActivityIndicator, Xamarin has provided pretty good components for iOS and android. i.e. btprogresshud for iOS and Andhud for Android. These components can be used through Xamarin.Forms.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.