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

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

在動(dòng)畫(huà)后顯示元素

在動(dòng)畫(huà)后顯示元素

慕的地6264312 2023-03-17 14:06:12
我希望在點(diǎn)擊TextView顯示動(dòng)畫(huà)之后(在動(dòng)畫(huà)之后)顯示一些模態(tài)窗口。我該怎么做?Ps 我的動(dòng)畫(huà)包含在 XML 文件中<animation-list>public class ExerciseWithExplain1 extends AppCompatActivity {    private Button solution;    private TextView txtVWRed, explainForTable, solExplain, nextScreen, falseRow53, falseRow54, falseRow55, falseRow56, falseRow46, trueRow45, trueRow44, falseRow43, trueRow36, trueRow35, falseRow34, trueRow33, trueRow23, falseRow23, trueRow25, trueRow24, falseRow24, falseRow25, falseRow26, falseRow33, trueRow34, falseRow35, falseRow36, trueRow43, falseRow44, falseRow45, trueRow46, trueRow53, trueRow54, trueRow55, trueRow56, trueRow26;    LinearLayout layForTable;    AlertDialog.Builder ad;    Context context;    AnimationDrawable animationDrawable;    ImageView animImage;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_exercise_with_explain1);        trueRow23 = findViewById(R.id.trueRow23);        falseRow23 = findViewById(R.id.falseRow23);        falseRow24 = findViewById(R.id.falseRow24);        trueRow24 = findViewById(R.id.trueRow24);        trueRow25 = findViewById(R.id.trueRow25);        falseRow25 = findViewById(R.id.falseRow25);        trueRow26 = findViewById(R.id.trueRow26);        falseRow26 = findViewById(R.id.falseRow26);        falseRow33 = findViewById(R.id.falseRow33);        trueRow33 = findViewById(R.id.trueRow33);        trueRow34 = findViewById(R.id.trueRow34);        falseRow34 = findViewById(R.id.falseRow34);        falseRow35 = findViewById(R.id.falseRow35);        trueRow35 = findViewById(R.id.trueRow35);
查看完整描述

1 回答

?
夢(mèng)里花落0921

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

您可以使用 Custom AnimationDrwable 進(jìn)行嘗試


import android.graphics.drawable.AnimationDrawable;

import android.os.Handler;


public abstract class CustomAnimationDrawableNew extends AnimationDrawable {


/** Handles the animation callback. */

Handler mAnimationHandler;


public CustomAnimationDrawableNew(AnimationDrawable aniDrawable) {

    /* Add each frame to our animation drawable */

    for (int i = 0; i < aniDrawable.getNumberOfFrames(); i++) {

        this.addFrame(aniDrawable.getFrame(i), aniDrawable.getDuration(i));

    }

}


@Override

public void start() {

    super.start();

    /*

     * Call super.start() to call the base class start animation method.

     * Then add a handler to call onAnimationFinish() when the total

     * duration for the animation has passed

     */

    mAnimationHandler = new Handler();

    mAnimationHandler.post(new Runnable() {

        @Override

        public void run() {

            onAnimationStart();

        }

    });

    mAnimationHandler.postDelayed(new Runnable() {

        @Override

        public void run() {

            onAnimationFinish();

        }

    }, getTotalDuration());


}


/**

 * Gets the total duration of all frames.

 *

 * @return The total duration.

 */

public int getTotalDuration() {


    int iDuration = 0;


    for (int i = 0; i < this.getNumberOfFrames(); i++) {

        iDuration += this.getDuration(i);

    }


    return iDuration;

}


/**

 * Called when the animation finishes.

 */

public abstract void onAnimationFinish();

/**

 * Called when the animation starts.

 */

public abstract void onAnimationStart();

}


現(xiàn)在像這段代碼一樣使用它。


TextView tv = (TextView) findViewById(R.id.iv_testing_testani);


tv.setOnClickListener(new OnClickListener() {

    public void onClick(final View v) {


        // Pass our animation drawable to our custom drawable class

        CustomAnimationDrawableNew cad = new CustomAnimationDrawableNew(

                (AnimationDrawable) getResources().getDrawable(

                        R.drawable.anim_test)) {

            @Override

            void onAnimationStart() {

                // Animation has started...

            }


            @Override

            void onAnimationFinish() {

                // Animation has finished...

            }

        };


        // Set the views drawable to our custom drawable

        v.setBackgroundDrawable(cad);


        // Start the animation

        cad.start();

    }

});


查看完整回答
反對(duì) 回復(fù) 2023-03-17
  • 1 回答
  • 0 關(guān)注
  • 162 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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