【发布时间】:2010-01-24 02:42:04
【问题描述】:
当前在我的应用程序中按下按钮后,我有一个基本动画。按钮完成动画后,我无法再单击它。它甚至没有以橙色突出显示。
有什么帮助吗?
这是我的代码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
animation = new AnimationSet(true);
animation.setFillAfter(true);
Animation translate = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 5.0f);
translate.setDuration(500);
animation.addAnimation(translate);
LayoutAnimationController controller = new LayoutAnimationController(animation, 0.25f);
generate = (Button)findViewById(R.id.Button01);
generate.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
keyFromTop();
}
});
}
public void keyFromTop(){
generate.setAnimation(animation);
}
【问题讨论】:
-
不确定“按钮的基本动画”是什么意思。您使用的是 Button 对象还是某种自定义视图?您能否提供一些代码,以便我们了解您在做什么?