80,354
社区成员
发帖
与我相关
我的任务
分享
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
View view = LayoutInflater.from(this).inflate(R.layout.test, null);
Animation animation = new AlphaAnimation(0.3f, 1.0f);
animation.setDuration(3000);
animation.setFillAfter(true);
view.startAnimation(animation);
this.setContentView(view);
}
}
刚写的,这个是启动就startAnimation();当然也可以做成触发的。呵呵,这个比较简单了,如果你用的是ValueAnimator或者是ObjectAnimator的话那个就更好控制了。