Android:如何动画viewstub?

时间:2011-03-07 23:32:37

标签: android animation view viewstub

如何用一些动画来扩充视图?

1 个答案:

答案 0 :(得分:5)

首先调用inflate()方法,然后在返回的视图上设置动画,如下所示:

View view = ((ViewStub) findViewById(R.id.stub_view)).inflate();
Animation animation = AnimationUtils.makeInAnimation(this, true);
animation.setDuration(300);
view.startAnimation(animation);