내 MapView
에 이미 많은 버튼이 있습니다. 그래서 하단의 투명 컨트롤도 내장하고 싶습니다. getZoomControl()
(MapView
)은 더 이상 사용되지 않습니다. 누구든지 getZoomControl
없이 컨트롤에 Buttons
을 보유하는 방법에 대한 아이디어가 있습니까? MapView에서 ZoomControl을 투명하게 만드는 방법은 무엇입니까?
편집 :
그래서 나는 그것을 알아 냈어. ZoomButtonsController
에는 단지 ViewGroup
인 컨테이너가 있음이 밝혀졌습니다. 그 컨테이너 아이들을 통해 의 인스턴스 인 객체를 파싱 할 수 있습니다. 이것은 ViewGroup
의 라인 인스턴스 아래입니다. ZoomControl
의 하위 항목을 분석하여 포함 된 ZoomButtons
을 가져올 수 있습니다. ZoomButton
및 setAlpha()
의 getBackground()
android.widget.ZoomButtonsController zbc = mapView.getZoomButtonsController();
ViewGroup container = zbc.getContainer();
for (int i = 0; i < container.getChildCount(); i++) {
View child = container.getChildAt(i);
if (child instanceof ZoomControls) {
ViewGroup zoomC = (ViewGroup)child;
for (int j = 0; j < zoomC.getChildCount(); j++) {
View btn = zoomC.getChildAt(j);
if (btn instanceof ZoomButton) {
((ZoomButton)btn).getBackground().setAlpha(120);
}
}
break;
}
}