1

I am inflating a view and putting the view below another, everything is fine but the animation is just coming once in desired fashion...and when i again press the button to put the view its not coming the way it had appeared first time.

HERE IS THE VIDEO

    final Animation a3 = new AlphaAnimation(0.00f, 1.00f);
    a3.setDuration(350);

    LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View cv = vi.inflate(R.layout.popupview, null);

    final RelativeLayout rl = (RelativeLayout)findViewById(R.id.mainlayout);
    final Button b1 = (Button)findViewById(R.id.button1);
    b1.setOnClickListener(new OnClickListener() {
        public void onClick(View arg0) {


            if(cv!=null){
                rl.removeView(cv);
            }

            RelativeLayout.LayoutParams innerLP = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
            cv.setLayoutParams(innerLP);

            RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
            params1.addRule(RelativeLayout.BELOW, b1.getId());
            cv.setLayoutParams(params1);

            cv.startAnimation(a3);
            rl.addView(cv);
            rl.invalidate();            

        }
    });
Programmer
  • 5,360
  • 10
  • 37
  • 61

1 Answers1

1

I had gone through same problem before.... You can check my post

It will start animation when it pressed once..but if u want to start again the animation then you should make it stop.

Community
  • 1
  • 1
Chirag_CID
  • 2,224
  • 1
  • 24
  • 33