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.
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();
}
});