我有一个viewpager,它有4个片段,其中一个是包含
的状态GRIDVIEW gridView中的每个项目内部都是progressBar
我在getView中使用setprogress()方法来正确地改变进度
问题是我随时刷回状态片段进度条
获得更多更新
,,例如:首先是30%
我向后滑动,我发现它是60%
我去了,我回来了它的90%
所以解决方案是让它只停留在30%
顺便说一下我使用这个循环进度条
<com.budiyev.android.circularprogressbar.CircularProgressBar
android:id="@+id/category_status"
android:layout_width="90dp"
android:layout_height="90dp"
app:backgroundStrokeColor="@color/blue"
app:animateProgress="true"
app:backgroundStrokeWidth="2dp"
app:drawBackgroundStroke="false"
app:foregroundStrokeCap="butt"
app:foregroundStrokeColor="#ffff4081"
app:foregroundStrokeWidth="3dp"
app:indeterminate="false"
app:indeterminateMinimumAngle="45"
app:indeterminateRotationAnimationDuration="1200"
app:indeterminateSweepAnimationDuration="600"
app:maximum="100"
app:progressAnimationDuration="1000"
app:startAngle="270" />
这是我的BaseAdapter
class status_Adapter extends BaseAdapter {
Context context;
ArrayList<cat> list;
public String[] tempdesc;
public status_Adapter(int scores[], Context c) {
this.context=c;
list =new ArrayList<cat>();
Resources res= context.getResources();
tempdesc=res.getStringArray(R.array.description);
for (int i=0;i<8;i++){
cat tempcategory =new cat(scores[i],tempdesc[i]);
list.add(tempcategory);
}
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return list.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
View row=view;
ViewHolder holder=null;
if(row==null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.single_row_status, viewGroup, false);
holder=new ViewHolder(row);
row.setTag(holder);
}else{
holder=(ViewHolder) row.getTag();
}
cat temp=list.get(i);
holder.prog.setProgress(temp.progress);
holder.category_name.setText(temp.description);
return row;
}