안녕 내 애플 리케이션에서 나는 그 중심에 대해 버튼을 회전하려고하지만 그것의 중심에 따라 회전하지 않는 대신 그것의 position.below에서 움직이는 것은 내 코드가 어떻게 도와 주시겠습니까? 그 문제를 해결하십시오.안드로이드에서 그 중심에 대해 버튼을 회전하는 방법
public class example extends Activity {
float newAngle,oldAngle=0;
int flag=0;
int n=340;
RotateAnimation animation,animation1;
Button arrow;
Button left,right;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
arrow=(Button)findViewById(R.id.img);
left=(Button)findViewById(R.id.left);
right=(Button)findViewById(R.id.right);
final int width = arrow.getWidth();
final int height = arrow.getHeight();
left.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(flag>=0)
{
newAngle = oldAngle+ 30;
oldAngle=newAngle;
}
flag++;
Log.i("flag",""+flag);
animation = new RotateAnimation(oldAngle, newAngle);
animation.setFillAfter(true);
animation.setDuration(200);
arrow.startAnimation(animation);
}
});
}
}
애니메이션 = new RotateAnimation (oldAngle, newAngle, 애니메이션 .RELATIVE_TO_SELF, 0.5f, 애니메이션 .RELATIVE_TO_SELF, 0.5f); \t \t \t \t animation.setInterpolator (new LinearInterpolator()); \t \t \t \t animation.setFillAfter (true); \t \t \t \t animation.setDuration (200); \t \t \t \t arrow.startAnimation (animation); – user1083266
이미지 뷰잉을 위해이 작업을 수행 할 때 언제 작동하지 않는가? – user1083266