안녕 모두 변경으로 나는 수직으로 90도 설정 바늘과 속도계가 어디 응용 프로그램을 작성했습니다
, 그 중심 주위에 속도계 바늘 게이지를 회전하며 회전하는 것을 시도하고있다 그 중심 주위의 바늘은 1 초마다 변화하는 속도로 바늘을 움직인다. (텍스트보기에서 속도를 0에서 120까지 무작위로 바꾼다.)
나는 원격 서비스에서 속도를 얻고 textview에 표시하고있다. .
속도가 바뀌면 속도계 바늘 게이지가 중앙을 기준으로 바뀌어야합니다. 내 말은 속도가 30 인 경우 바늘은 속도계에서 30 등이되어야 함을 의미합니다.
내 코드가 정확하게 작동하지 않습니다. 어떻게이 문제를 해결할 수 있습니까?
도움말 항상 감사드립니다.
pointer1 = (ImageView) findViewById(R.id.pointer1);
double degrees= speed;
double angle = degrees * 2 * Math.PI/360.0;
for(speed=0;speed<120;speed++){
RotateAnimation rAnimAntiClockWise = new RotateAnimation(180-0.0f, 180-speed,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rAnimAntiClockWise.setInterpolator(new LinearInterpolator());
rAnimAntiClockWise.setDuration(100);
rAnimAntiClockWise.setFillAfter(true);
rAnimAntiClockWise.setDuration(10000);
rAnimAntiClockWise.setRepeatCount(-1);
rAnimAntiClockWise.setRepeatMode(2);
pointer1.startAnimation(rAnimAntiClockWise);
}
private void invokeService() {
if (conn == null) {
} else {
try {
System.out.println(remoteService);
int speed = remoteService.getSpeed();
System.out.println("myspeed" + speed);
TextView r = (TextView) findViewById(R.id.text2);
r.setText("" + Integer.toString(speed));
Log.d(getClass().getSimpleName(), "invokeService()");
} catch (RemoteException re) {
Log.e(getClass().getSimpleName(), "RemoteException");
}
}
}
* 내 코드가 정확히 작동하지 않습니다 *>은 무엇을하고 있습니까? 당신의 오류는 무엇입니까? –
@ Anders Metnik, 에러는 없지만 90도에서 45도까지 반올림하여 반올림 해 보겠습니다. – Randroid
그래, 코드에서 요구하는 것처럼 보입니다. –