0
저는 onDraw 메서드를 재정의하고 원을 그린 사용자 정의보기가 있습니다. 이제 원의 중심에서 원의 꼭대기까지 선을 그립니다. 여기안드로이드 - 수직으로 선을 그립니다.
내 코드이다 ..
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawRect(0, 0, getWidth(), getHeight(), backgroundPaint);
canvas.drawCircle(centerX, centerY, outerRadius, outerCirclePaint);
double angleRadians = Math.toRadians(0);
double x = (outerRadius * Math.cos(angleRadians)) + centerX;
double y = (outerRadius * Math.sin(angleRadians)) + centerY;
canvas.drawLine((float)x, (float)y, centerX, centerY, innerCirclePaint);
}
centerX 및 centerY 내가이 광고가 중심으로부터 그려진 실행할 때 원 outerRadius의 중심 원
대한 반경이다 원의 0도 대신에 90 도의 오른쪽 0도. 비록 내가 각도가 0이라고 말했지만,
이것은 혼란스럽고 내가 잘못하고있는 것처럼 보일 수 없다. 누구나 이것에 대한 아이디어가 있으면 매우 감사 할 것입니다.
고맙습니다. – Pagrate