我有一个带有动画的按钮(放置在线性布局中)。动画完成后(简单 translateAnimation),我希望启用该动画按钮。我意识到使用动画仅对可绘制按钮有影响,因此可点击的“位置”保持在原始位置。
layout= (LinearLayout) findViewById (R.id.newitemtext);
layout.setBackgroundResource(R.drawable.white_box);
btn = (Button) findViewById (R.id.btn);
moveLefttoRight = new TranslateAnimation(0,0 , 0, 200);
moveLefttoRight.setDuration(1000);
moveLefttoRight.setFillAfter(true);
animbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
layout.startAnimation(moveLefttoRight);
layout.setEnabled(true);
}
});
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.i("TAG", "CCIK");
}
});
btn 按钮位于 LinearLayout 布局中。动画后如何设置位置?我尝试使用 setPadding 但没有成功。提前致谢!