Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: how to animate viewstub?

How to inflate view with some animation?

like image 743
Urban Avatar asked Mar 07 '11 23:03

Urban


1 Answers

First call the inflate() method, then setup an animation on the returned view, like this:

View view = ((ViewStub) findViewById(R.id.stub_view)).inflate();
Animation animation = AnimationUtils.makeInAnimation(this, true);
animation.setDuration(300);
view.startAnimation(animation);
like image 50
Sven Avatar answered Sep 23 '22 14:09

Sven