第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在android中重復(fù)查看動(dòng)畫變量的次數(shù)?

如何在android中重復(fù)查看動(dòng)畫變量的次數(shù)?

湖上湖 2023-06-28 16:18:44
我有這個(gè)swapAnimation方法,基本上可以交換兩個(gè)視圖。我在循環(huán)內(nèi)調(diào)用此方法,并swapAnimation每次傳遞該方法的不同視圖。但問題是這種animation情況只會(huì)發(fā)生一次。我想讓它重復(fù)n次。void swapAnimation(View v1,View v2){        if(isAnimating)return;        isAnimating = true;        float x1,y1,x2,y2;        x1 =getRelativeX(v1);        x2 = getRelativeX(v2);        y1 = getRelativeY(v1);        y2 = getRelativeY(v2);        float x_displacement = (x2-x1);        float y_displacement = (y2-y1);        v1.animate().xBy(x_displacement).yBy(y_displacement);        v2.animate().xBy(-x_displacement).yBy(-y_displacement);        v1.animate().setDuration(500);        v2.animate().setDuration(500);        long duration = v1.animate().getDuration();        new CountDownTimer(duration+10,duration+10){            @Override            public void onTick(long millisUntilFinished) {            }            @Override            public void onFinish() {                isAnimating = false;            }        }.start();    }public static void arrange(LinearLayout container, Context context){        MainActivity activity = (MainActivity) context;        for(int i=0;i<container.getChildCount();i++){            BarView v1 = (BarView) container.getChildAt(i);            for(int j=i;j<container.getChildCount();j++){                BarView v2 = (BarView) container.getChildAt(j);                if(v1.getWeight() > v2.getWeight()){                    Log.d(TAG, "bubbleSort: "+v1.getWeight()+">"+v2.getWeight());                    activity.swapAnimation(v1,v2);                }            }        }    }
查看完整描述

1 回答

?
墨色風(fēng)雨

TA貢獻(xiàn)1853條經(jīng)驗(yàn) 獲得超6個(gè)贊

嘗試這個(gè)

animation.setRepeatCount(Animation.INFINITE);


查看完整回答
反對(duì) 回復(fù) 2023-06-28
  • 1 回答
  • 0 關(guān)注
  • 146 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)