0
我有一個按鈕和基本視圖的活動。當按鈕被點擊時,動畫應該開始。但是,當前按鈕被點擊時沒有任何反應。如果我將代碼移動到按鈕外部並進入onCreate方法,則動畫將起作用,但當按鈕被點擊時,我不會發生這種情況。Android - 動畫將無法啓動按鈕點擊
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
final Button start_button = (Button) findViewById(R.id.main_button);
final View inside_circle = findViewById(R.id.timer);
start_button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
ScaleAnimation growAnim = new ScaleAnimation(1.0f, 3.68f, 1.0f, 3.68f, Animation.RELATIVE_TO_SELF, 0.5F, Animation.RELATIVE_TO_SELF, 0.5F);
growAnim.setDuration(3000);
inside_circle.setAnimation(growAnim);
growAnim.start();
}
});
}