Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ListView中的动画ProgressBar_Android_Jquery_Listview_Animation_Android Arrayadapter - Fatal编程技术网

Android ListView中的动画ProgressBar

Android ListView中的动画ProgressBar,android,jquery,listview,animation,android-arrayadapter,Android,Jquery,Listview,Animation,Android Arrayadapter,我已经创建了一个包含5项的列表。列表项有一个带有循环、文本和进度条的布局。如果某个错误为真,则应设置进度条的动画。如果此值为FALSE。progressbar应为空(progress.setProgress(0))。 动画显示为以下内容: final ObjectAnimator animation = ObjectAnimator.ofInt(power, "progress", currentWP.power()); animation.setDuration(2000); // 2 Sek

我已经创建了一个包含5项的列表。列表项有一个带有循环、文本和进度条的布局。如果某个错误为真,则应设置进度条的动画。如果此值为FALSE。progressbar应为空(progress.setProgress(0))。 动画显示为以下内容:

final ObjectAnimator animation = ObjectAnimator.ofInt(power, "progress", currentWP.power());
animation.setDuration(2000); // 2 Sekunden
animation.setInterpolator(new DecelerateInterpolator());
animation.start();
power是应设置动画的进度条,currentWP.power()是应停止动画的值。 progressbar最大值设置为100

问题在于,尽管值为FALSE且currentWP.power为0,但First listitem的动画仍会启动。动画结束值与最后一个listitem的结束值相同

列表视图:

private class MyListAdapter extends ArrayAdapter<WP> {

    public MyListAdapter() {
        super(Overview_Activity.this, R.layout.list_item, windparks);
        //Log.d("MyList","start");
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        //Log.d("View","start");
        View itemView = convertView;
        if (itemView == null) {
            itemView = getLayoutInflater().inflate(R.layout.list_item, parent, false);
        }

        final WP currentWP = windparks.get(position);

        //WP-Name
        TextView name = (TextView)itemView.findViewById(R.id.WP_name);
        name.setText(currentWP.getname());

        //WP-Icon
        final ImageView status = (ImageView)itemView.findViewById(R.id.error_icon);

        //WP-Produktion

        //Log.d("WP", currentWP.getname());
        //Log.d("Power", String.valueOf(currentWP.power()));

        final ProgressBar power = (ProgressBar)itemView.findViewById(R.id.power_overview);
        //power.setProgress(0);

            if (!currentWP.getstatus()) {
                status.setImageResource(R.drawable.round_error);
                power.setProgress(0);
                name.setTextColor(getResources().getColor(R.color.grey));
            } else {
                status.setImageResource(R.drawable.round_ok);
                //power.setProgress(currentWP.power());
                Log.d(currentWP.getname(), String.valueOf(currentWP.getstatus()));
                name.setTextColor(getResources().getColor(R.color.blue));

                //Animation erstellen und starten
                final ObjectAnimator animation = ObjectAnimator.ofInt(power, "progress", 0, currentWP.power());
                animation.setDuration(2000); // 2 Sekunden
                animation.setInterpolator(new DecelerateInterpolator());
                animation.start();

            }

        return itemView;
    }
私有类MyListAdapter扩展了ArrayAdapter{
公共MyListAdapter(){
超级(概述活动、本、R、布局、列表项目、风电场);
//Log.d(“MyList”、“start”);
}
@凌驾
公共视图getView(int位置、视图转换视图、视图组父视图){
//Log.d(“查看”、“开始”);
视图项视图=转换视图;
如果(itemView==null){
itemView=GetLayoutFlater()。充气(R.layout.list\u项,父项,false);
}
最终WP currentWP=windparks.get(位置);
//可湿性粉剂名称
TextView name=(TextView)itemView.findViewById(R.id.WP_name);
name.setText(currentWP.getname());
//WP图标
最终ImageView状态=(ImageView)itemView.findViewById(R.id.error_图标);
//可湿性粉剂生产
//Log.d(“WP”,currentWP.getname());
//Log.d(“Power”,String.valueOf(currentWP.Power());
最终ProgressBar电源=(ProgressBar)itemView.findViewById(R.id.power\u概览);
//电源设置进度(0);
如果(!currentWP.getstatus()){
status.setImageResource(R.drawable.round_错误);
电源设置进度(0);
name.setTextColor(getResources().getColor(R.color.grey));
}否则{
状态。setImageResource(R.drawable.round_ok);
//power.setProgress(currentWP.power());
Log.d(currentWP.getname(),String.valueOf(currentWP.getstatus());
name.setTextColor(getResources().getColor(R.color.blue));
//动画厄斯泰伦和斯塔滕
final ObjectAnimator animation=ObjectAnimator.ofInt(power,“progress”,0,currentWP.power());
animation.setDuration(2000);//2 Sekunden
setInterpolator(新减速器Interpolator());
animation.start();
}
返回项目视图;
}
我也尝试过不使用动画。我将进度设置为特定值。这很好。但是我想设置进度条的动画