OnClickListener problemas após ImageButton movido após TranslateAnimation
O que devo fazer para mover o imageButton para um novo local e manter o evento OnClick?
Eu tenho duas perguntas sobre isso:
Se eu usar fillAfter (true), o onclick não será levado para o novo local.Se usar setAnimationListener (onAnimationEnd) e chamar layout () para mover o ImageButton para um novo local, o ImageButton retornará para o novo local de início, por quê?códigos aqui:
<code> tsla = new TranslateAnimation(0.0f,(float) (imgWidth * 0.45)-wh/2,0.0f,(float) (imgHeight * 0.566666667)-wh/2); tsla.setDuration(sleepX); tsla.setAnimationListener(new AnimationListener(){ public void onAnimationStart(Animation arg0) { } public void onAnimationEnd(Animation arg0) { imgBtnChengdu.layout( (int) (imgWidth * 0.45), (int) (imgHeight * 0.566666667), (int) (imgWidth - wh - imgWidth * 0.45), (int) (imgHeight - wh - imgHeight * 0.566666667) ); } public void onAnimationRepeat(Animation arg0) { } }); imgBtnChengdu.setAnimation(tsla); </code>