0

さて、私はこの言葉で新しい人です。ボタンを押すと他のボタンのアニメーションが発生し、膨張も発生するため、膨張を遅らせようとしています。

ただし、インフレートがすぐに発生するため、アニメーションを表示できません。そのため、最初にアニメーションを表示し、次にインフレートに含まれる情報を表示できるように、インフレートを2000ミリ秒のように遅らせたいと思います。

アニメーションと膨張を呼び出すために同じボタンを使用しています。

これが私のコードです:

 case R.id.btnsalud:

    //This is the code for animations   

        //This is the loader for all the animations that is used for the button
        {final Animation animBounceForSalud = AnimationUtils.loadAnimation(this, R.anim.bounce);
        final Animation animBounceForSalud1 = AnimationUtils.loadAnimation(this, R.anim.bounce1);
        //This object is the objects (buttons) whom is applied the animation
        final Button animSalud = (Button)findViewById(R.id.btnobra);
        final Button animSalud1 = (Button)findViewById(R.id.btnprotesta);
        //This object (button) is the one which applies the animation to the other buttons
        Button btnBounceSalud = (Button)findViewById(R.id.btnsalud);      
    animSalud.startAnimation(animBounceForSalud);
    animSalud1.startAnimation(animBounceForSalud1);
    animSalud.setVisibility(500);
    animSalud1.setVisibility(500);}



    //This is the code for inflate  
    //Check if the Layout already exists
    LinearLayout hiddenLayout1 = (LinearLayout)findViewById(R.id.hiddenLayout);
    if((hiddenLayout1 == null)){
        //Right here is where you can defined in which layout is going to 
        //inflate the hidden layout
        LinearLayout myLayout = (LinearLayout)findViewById(R.id.inflateposition0);
        View hiddenInfo = getLayoutInflater().inflate(R.layout.salud, myLayout, false);
        myLayout.addView(hiddenInfo);

    }

    break;

どんな答えも高く評価されます:D

4

2 に答える 2

0

アニメーション定義でdurationパラメータを設定して、アニメーションの長さを修正できます。JavaにはsetDuration(time)メソッドがあり、XMLでアニメーションを定義するためにandroid:durationプロパティがあります。 http://developer.android.com/guide/topics/resources/animation-resource.html

于 2013-01-30T19:49:21.470 に答える
0

アニメーションのリスナーを設定し(http://developer.android.com/reference/android/view/animation/Animation.html#setAnimationListener(android.view.animation.Animation.AnimationListener))、次の場合にのみビューを追加する必要があります。リスナーは、アニメーションが終了したことを報告します。

于 2013-01-30T18:16:15.517 に答える