0
我正在處理簡單的登錄活動。我有一個按鈕和一個旋轉動畫。點擊按鈕後,它應該運行動畫,然後調用需要幾秒鐘完成的登錄方法。GUI不會更新,直到函數執行結束
問題是動畫在登錄函數執行完成時(在佈局改變之前)開始。
這是我的嘗試:
private void BtnpPrijava_Click(object sender, EventArgs e)
{
this.RunOnUiThread(() => {
string username = edttxtKorisnicko.Text;
string password = edttxtSifra.Text;
var rotateAboutCornerAnimation = AnimationUtils.LoadAnimation(this, Resource.Layout.RotationAnimation);
imageViewForRotation.Visibility = ViewStates.Visible;
imageViewForRotation.StartAnimation(rotateAboutCornerAnimation);
success = LogInController.Instance.Login(username, password);
if (success)
{
StartActivity(typeof(MainActivity));
}
}}
我也試圖把這些只有3行代碼在RunOnUIThread:
var rotateAboutCornerAnimation = AnimationUtils.LoadAnimation(this, Resource.Layout.RotationAnimation);
imageViewForRotation.Visibility = ViewStates.Visible;
imageViewForRotation.StartAnimation(rotateAboutCornerAnimation);
任何人都可以點我什麼我做錯了嗎?