【发布时间】:2016-08-22 20:39:09
【问题描述】:
创建了一个与动画配合良好的圆形进度条。但是在尝试使用动态数据进度条显示它时没有更新。
下面的代码正在运行
progrssBarObj = FindViewById<ProgressBar>(Resource.Id.progressBarSync);
ObjectAnimator animation = ObjectAnimator.OfInt(progrssBarObj, "progress", 0, 100); // see this max value coming back here, we animale towards that value
animation.SetDuration(3000); //in milliseconds
animation.SetInterpolator(new DecelerateInterpolator());
animation.Start();
AXML 代码是
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_column="2"
android:id="@+id/progressBarSync"
android:layout_width="300dp"
android:layout_height="300dp"
android:progressDrawable="@drawable/circular_progress_bar"
android:background="@drawable/progress_bar_background" />
但是当我在循环中尝试类似的操作时,进度条不会随数据更新。基本上进度条不会循环更新。
for (int i = 0; i <= 100; i++)
{
int cnt = 0;
cnt = cnt + i;
progrssBarObj.Progress = cnt;
}
我们将不胜感激。
【问题讨论】:
标签: c# android xamarin.android android-progressbar