In 2.2 SDK I'm rotating a TextView and I've attached an onClickListener to display a dummy text in console, but the onClick method isn't fired. Is something wrong with my code, or there is a workaround?
public void setTextViewRotation(int angle, TextView tv) {
RotateAnimation rayAnim = new RotateAnimation(0, angle - 90, -100, 22);
rayAnim.setFillAfter(true);
rayAnim.setDuration(1);
rayAnim.setAnimationListener(this);
tv.setAnimation(rayAnim);
}
... textView declaration...setTextViewRotation(angle, textView);
... textView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.i("Main","select ray");
}
});
It happens when you apply animation to any component.
In your case may be you are clicking on new position of textview.
It shows that you have moved that component.
But actually that components retains its original position.
It does not moves from his original position.
You can say its android limitation.
But now it is solved in API level 3.0
You can try 3.0 or above. for more read this