我正在读一本书“ Pragmatics:Hello Android”
并复制代码单词和语法都是正确的,因为我没有错误,但是它没有执行我在onAnimationEnd上告诉它的操作。它像txtView.setText(“ ggag”)这样简单
只是看它是否还在执行...而我注意到这本书的处理方式略有不同。
Animation fadein = AnimationUtils.loadAnimation(this, R.anim.fade_in);
fadein.setAnimationListener(new AnimationListener() { /*im thinking the problem is
that it does all the work from within the setAnimationLIstener instead of like i
have seen around where the methods onAnimationEnd , onAnimationRepeat are all
done seprately outside of the
setAnimationListener(new AnimationListener() {..all work is done here??... } */
@Override
public void onAnimationEnd(Animation animation) {
//startActivity(new Intent(splahActivity.this,menuActivity.class));
//the above line of code was not working so i added the line below
//neither executes
TextView topLogo = (TextView)findViewById(R.id.lblTop);
topLogo.setText("dfsgsdfg");
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
});
所以是的,我的onAnimationEnd代码永远不会执行:(
最佳答案
您是否调用了fadein.start()?
onAnimationStart()中的代码(例如记录一条消息)是否运行?
关于android - OnAnimationEnd不起作用,并且已经研究过,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3965644/