2016-06-05 6 views
0

Eigentlich möchte ich einen Ladedailog auf einen Knopfklick erstellen.Wie zeigt man einen SfBusyIndicator bei einem Klick? C# xamarin.android azurblau android

Ich habe dieses Tutorial gefolgt http://help.syncfusion.com/xamarin-android/sfbusyindicator/getting-started

das ist mein Knopf.

Button btnCLick = Findviewbyid<button>(resource.id.btnclikc); 
btnCLick.Click += btnCLick_CLICK; 
void btnCLick_Click (object sender, System.EventArgs e) 
{ 
// here i need to start a dailog box like loading. 
// but i use a Sync fusion busy indicator here. 
// 
sfBusyIndicator = new SfBusyIndicator(this); 
     sfBusyIndicator.TextColor = Color.Rgb(62,101,254); 
     sfBusyIndicator.AnimationType = AnimationTypes.DoubleCircle; 
     sfBusyIndicator.ViewBoxWidth = 200; 
     sfBusyIndicator.ViewBoxHeight = 200; 
     sfBusyIndicator.TextSize = 60; 
     sfBusyIndicator.Title = "Loading ... Please Wait ..."; 

sfBusyIndicator.IsBusy = true; 
// a Lot of work is done here for around 15 seconds. a database connection is called. 
sfBusyIndicator.IsBusy = false; 

// again some work 

StartActivity(typeof(ACT)); 
} 

Die Busyindicator Dosent kommen.

und nachdem die Verbindung hergestellt ist und alle 15 Sekunden Arbeit erledigt sind, wird die Aktivität gestartet. und wenn die Aktivität beginnt, wird nur das Popup geladen. Das heißt, nachdem die ganze Arbeit abgeschlossen ist, wird der Ladebildschirm gestartet.

Wie kann ich den Ladebildschirm starten, wenn auf die Schaltfläche geklickt wird.

Antwort

0

SfBusyIndicator is a View, es muss ein Teil Ihres derzeit gezeigten Layouts sein. Etwas in etwas wie:

<LinearLayout 
    ... /> 
    <Com.Syncfusion.Sfbusyindicator.SfBusyIndicator 
     android:id="@+id/indicator" 
     ... /> 
</LinearLayout> 

Dann ist es in Ihrer Tätigkeit finden:

var indicator = FindViewById<SfBusyIndicator>(Resource.Id.indicator); 
indicator.TextColor = Color.Rgb(62,101,254); 
indicator.AnimationType = AnimationTypes.DoubleCircle; 
indicator.ViewBoxWidth = 200; 
indicator.ViewBoxHeight = 200; 
indicator.TextSize = 60; 
indicator.Title = "Loading ... Please Wait ..."; 
+0

hilft es, einen Fehler gibt Binary XML-Datei Zeile # 1: Fehler aufblähenden Klasse Com.Syncfusion.sfBusyIndicator.SfBusyIndicator –

+0

Der Indikator entweder Code oder xml initialisiert werden kann. – ComeIn

0

Sie müssen die Besetztanzeige zu einem Aufnahme Layout/Ansicht hinzufügen, bevor sie angezeigt werden. z.B.

sfBusyIndicator = new SfBusyIndicator(this); 
    sfBusyIndicator.TextColor = Color.Rgb(62,101,254); 
    sfBusyIndicator.AnimationType = AnimationTypes.DoubleCircle; 
    sfBusyIndicator.ViewBoxWidth = 200; 
    sfBusyIndicator.ViewBoxHeight = 200; 
    sfBusyIndicator.TextSize = 60; 
    sfBusyIndicator.Title = "Loading ... Please Wait ..."; 

sfBusyIndicator.IsBusy = true; 
FrameLayout busyIndicatorHolder = new FrameLayout(this); 
busyIndicatorHolder.AddView(sfBusyIndicator); 

// a Lot of work is done here for around 15 seconds. a database connection is 
called. 

sfBusyIndicator.IsBusy = false; 

Wenn Ihr „Viel Arbeit getan ist ...“ ist ein AsyncTask dann würde ich den Anruf zu sfBusyIndicator.IsBusy setzen = true in der PreExecute der Aufgabe und der IsBusy = false; in der PostExecute.

Hoffe, dass es

Verwandte Themen