Saturday 15 August 2015

android - UI components are not functional using a MapFragment? -


Then I have the following code in a fragment class while trying to show a Google map, although the location has been successfully detected And zoomed in, all other UI components (like location buttons) are not displayed and the map is not responsible for gestures in some way. What's the problem?

If I try to call the SetupMap () before the footage, then the map is not apparently ready and I get a blank pointer with GetMap. Creatives on public view (LayoutInflator Inflator, View Group Container, Bundle Saved InstantState) {mMapFragment = MapFragment.newInstance (); Piece transaction fragment transaction = getFragmentManager (). BeginTransaction (); Section transaction.ed (ridmap, ammoffraagment); FragmentTransaction.commit (); V = see inflater.inflate (R.layout.afragment, container, false); SetupMap (); // increase the layout for this piece returns v; }

And I have set my map with:

  Private zeros setup map () {if (mMap == null) {mMap = ( (MapFragment) getFragmentManager () FindFragmentById (R.id.map)) .getMap (); // Check that we have been able to get the map. If (mMap! = Null) {// Set Location etc ........ mMap.getUiSettings () SetAllGesturesEnabled (true); MMap.getUiSettings () setMyLocationButtonEnabled (true). MMap.getUiSettings () setZoomControlsEnabled (true). MMap.getUiSettings () setZoomGesturesEnabled (true). // Zoom into Google Maps mMap.animateCamera (CameraUpdateFactory.zoomTo (14)); MMap.setOnMapClickListener (this); }}}    

insert a piece inside another < Code> piece is difficult.

Try this code instead:

Ensure that you use if you are developing for API 17 (Android 4.2), then you should use the library Have to support.

Read also:

No comments:

Post a Comment