SetFillAfter not working?

I am using this code:

  public class Main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

 final   LinearLayout answerLayout=(LinearLayout)findViewById(R.id.answerlayout);

    Button slideAnswer=(Button)findViewById(R.id.answerslide);
    slideAnswer.setOnClickListener(new View.OnClickListener() {

    @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

                TranslateAnimation slide = new TranslateAnimation(0,-400, 0,0 );   
                slide.setDuration(1000);   
                slide.setFillAfter(true);   
                slide.setFillEnabled(true);
                answerLayout.startAnimation(slide);  

        }
    });
}

I just want answerLayout to revert and stay in that place and work fine. But this is not so. Can someone please point out the error and correct me. Or give another technique for the same?

+3
source share

All Articles