2011-07-01 6 views
0

내 베어링 onLocationChanged에 따라 오버레이 항목 (드로어 블)을 회전하고 싶습니다. 어떻게해야합니까? itemableOverlay 및 overlayItem을 사용하여 drawable을 시도했지만 성공하지는 못했습니다.Android mapView : 오버레이 항목 회전

public void bearingRotation(float boatBearing){      
    Bitmap bm = ((BitmapDrawable)drawableCurrPos).getBitmap();   
    Matrix mat = new Matrix(); 
    mat.postRotate(boatBearing); 
    Bitmap bMapRotate = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),bm.getHeight(), mat, true); 

    drawableCurrPos = new BitmapDrawable(bMapRotate);      
} 

답변

0

그 드로어 블을 비트 맵으로 변환하는 것이 좋습니다.

Bitmap bm = ((BitmapDrawable)drawable).getBitmap(); 
Matrix mat = new Matrix(); 
     mat.postRotate(90); 
     Bitmap bMapRotate = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(),bm.getHeight(), mat, true); 

이 bMapRotate를 BitmapDrawable로 변환하고이를 사용자의 위치에 대한 핀 포인터로 적용하십시오.

+0

핀 포인터에 대해 좀 더 정확하게 설명해 주시겠습니까? – Hannes

+0

이것은 드로어 블뿐만 아니라 비트 맵에도 항목화된 오버레이를 사용해야한다는 의미입니까? – Hannes

+0

@ Hannes ..지도에 오버레이 아이템을 표시 할 수 있다면 위의 코드는 해당 드로어 블을 회전하는 데 유용합니다. 해당 드로어 블을 회전하려면 오버레이 Item에서 drawable을 제거한 다음 drawable을 회전합니다 (위의 경우 90도 회전). 그런 다음 해당 드로어 블을 오버레이 항목에 다시 추가하십시오. – Harshad