You have to typecast on getZoomControls() since setGravity(int) is a method of LinearLayout and the ZoomControls are a LinearLayout: LinearLayout zoomView = (LinearLayout) mMapView.getZoomControls();
On 25 Aug., 06:34, "Casey Borders" <[EMAIL PROTECTED]> wrote: > This isn't working for me! It tells me that .setGravity(int) is not > valid for type View. Why is that?! > > 2008/8/24 marcel-182 <[EMAIL PROTECTED]>: > > > > > Works fine, thanks a lot. I can finally zoom.. weeee > > > On 24 Aug., 16:55, adamrocker <[EMAIL PROTECTED]> wrote: > >> Hi. > > >> You can move the ZoomControls to center bottom of the window using the > >> following code > > >> // Zoom View > >> View zoomView = mMapView.getZoomControls(); > >> zoomView.setLayoutParams( new ViewGroup.LayoutParams > > >> ( ViewGroup.LayoutParams.FILL_PARENT, > > >> ViewGroup.LayoutParams.FILL_PARENT ) ); > >> zoomView.setGravity(Gravity.BOTTOM + Gravity.CENTER_HORIZONTAL); > >> mMapView.addView(zoomView); > >> mMapView.displayZoomControls(true); > > >> Is this the answer what you want? > > >> On 8月23日, 午前1:58, marcel-182 <[EMAIL PROTECTED]> wrote: > > >> > Hey, > > >> > I have the same problem. I want my MapView to handle the ZoomControls > >> > like in the standard Maps application but haven't found a way how to > >> > do it :-(. > > >> > On 22 Aug., 11:45, Cristina <[EMAIL PROTECTED]> wrote: > > >> > > Hi! > > >> > > I am trying to show the zoom controls over a MapView in the new 0.9 > >> > > SDK. > > >> > > I have been able to show the zoom Control View using the following > >> > > code > >> > > // Zoom View > >> > > View zoomView = mMapView.getZoomControls(); > >> > > zoomView.setLayoutParams(new ViewGroup.LayoutParams > >> > > (ViewGroup.LayoutParams.WRAP_CONTENT, > >> > > ViewGroup.LayoutParams.WRAP_CONTENT)); > >> > > mMapView.addView(zoomView); > >> > > mMapView.displayZoomControls(true); > > >> > > Using this code, I have been able to show the Zoom Control View at the > >> > > top-left edge the screen (over the map). > >> > > However, I will want it to be a the bottom of the screen, and I do > >> > > not know how to move it to that position. > > >> > > I have tried to use de ViewGroup method requestChildRectangleOnScreen, > >> > > in order to move the zoomView to the position I want, but I have been > >> > > not able to make it work. > > >> > > Can anyone help me with this issue? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

