I have a view that I inflate when a use clicks a button, and I want to animate the view to the screen when the button is clicked, I have tried the code below but the view just snaps to the screen instead of animates on to the screen. I am not sure why the view will not animate into position. The view I want to animate is previewMemberPanel
previewMemberPanel = ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
.inflate(R.layout.main_member_listing_imagepreview, null, false);
//button click body
Animation anim = new TranslateAnimation(new DisplayMetrics().widthPixels / 2, 0, 0, 0);
anim.setFillAfter(true);
anim.setDuration(5000);
anim.setStartOffset(500);
if( !previewMemberPanel.isShown() ){
((LinearLayout) findViewById(R.id.rootMembers)).addView(previewMemberPanel);
previewMemberPanel.startAnimation(anim);
}