My app has a small web view that I want to animate into place once the page has finished loading. My code looks like this:
view.setVisibility(View.VISIBLE);
TranslateAnimation anim=new TranslateAnimation(0.0f, 0.0f,
view.getLayoutParams().height, 0.0f);
anim.setDuration(5);
anim.setInterpolator(new LinearInterpolator());
view.startAnimation(anim);
It animates all right, but I can’t seem to control the speed. I’ve set the value for setDuration() to 5, 500, 5000, 5000000 – all to no discernible effect.
Is there something else I need to do to control animation duration?
BTW my base SDK is 1.6.
I use XML approach for setting animation for a layout.
translate.xml
To control the animation duration, you could try changing
android:duration ="500"to values you require.layout_anim_controller.xml
Setting the Animation for the layout
Maybe this helps a little bit in the right direction.