我有一个和LinearLayout
几个。我希望我的背景定时闪烁,比如从红色到白色再到红色等等。现在,我正在尝试这段代码,但它给了我一个空指针异常。Buttons
TextViews
LinearLayout ll = (LinearLayout) findViewById(R.layout.activity_main);
Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50);
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
ll.startAnimation(anim); // shows null pointer exception at this line
请帮助我我哪里出错了?