간단한 질문 일 수도 있지만 해결책을 찾을 수 없습니다.문제를 해결하는 방법 업데이트/새로 고침을하는 동안 - 애니메이션을 표시 하시겠습니까?
일부 콘텐츠를 새로 고치거나 업데이트하기위한 버튼이 있습니다. "새로 고침"단추. 이 버튼의 배경에는 이미지가 있습니다. 내 콘텐츠가 업데이트되는 동안이 이미지에 대한 회전 애니메이션을 설정하고 싶습니다. 그러나 나는 약간의 문제가 있습니다. 첫째, 내 컨텐츠가 업데이트되었고 애니메이션을 볼 수있는 것보다 : 여기 내 코드가 있습니다.
Timer myTimer;
public void timerS()
{
myTimer = new Timer();
myTimer.schedule(new TimerTask() {
@Override
public void run() {
TimerMethod();
}
}, 0, 100);
}
private void TimerMethod()
{
this.runOnUiThread(Timer_Tick);
}
private Runnable Timer_Tick = new Runnable() {
public void run() {
// drawMatrix();
animation();
seconds++;
}
};
int degree =60;
int oneClick=1;
public int nowUpdated = 0;
public void animation()
{
int currentRotation = 0;
RotateAnimation anim = new RotateAnimation(currentRotation, (360*4),
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
currentRotation = (currentRotation + 45) % 360;
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(10000);
anim.setFillEnabled(true);
anim.setFillAfter(true);
refresh.startAnimation(anim);
}
나는 이것을 위해 타이머를 사용하려고했습니다. 첫 번째 예제는 drawMatrix와 함께했지만 이미지 크기가 문제가 될 수 없습니다. 이미지가 회전하면 애니메이션이 매우 커집니다. 이미지 크기 32x32 ..하지만 업데이트를 클릭하면 - 이미지 크기가 64x64라고 생각합니다. 와 무승부 행렬이 다음 코드를 수정할 수 없습니다 : 누군가가 나를 도울 수 있다면
는public void drawMatrix()
{
if(nowUpdated==1)
{
Matrix mat = new Matrix();
degree=degree+45;
mat.postRotate(degree);
Bitmap source = BitmapFactory.decodeResource(getResources(),R.drawable.refresh);
Bitmap a = Bitmap.createBitmap(source, 0, 0, 32 , 32, mat, true);
Drawable d =new BitmapDrawable(a);
refresh.setBackgroundDrawable(d);
}
}
하십시오 - 어떻게 처음으로 내 코드 또는 두 번째 해결 방법을 가르쳐주십시오. 감사합니다.
yeeeeeep을 Ready4Android
건배, : D (4more) – Peter
Ready4Android, 당신은 scype 로그인 할 수 있습니까? – Peter
안녕하세요. 나에게 메시지를 쓸 수 있습니까? – Peter