android - MapFragment hides everything in fragment -
Hi I'm using the navigation drawer and several pieces in my project.
Now that the piece gets loaded, then it hides each other's idea to have a parent's piece.
And when I click on the second piece, the map back in the map.
The following is my fragment XML
& Lt; EditText Android: Android: Android: Android: Android: AMS = "10" Android: Hint = "Search" / Android: Android: Android: Layout_With = "Wrap-content" Android: & lt; / LinearLayout & gt; & Lt; / FrameLayout & gt;
And the following is the Java file for my piece.
Public Square MyRouteFragment spreads the fragment {public MyRouteFragment () {} EditText etSearchValue; Private Letlang Myopos; User data user; See Routeview; GoogleMap Map View; Mapfragment mapfraigement; & Lt; Marker & gt; Marker = New Arrestist & lt; Marker & gt; (); Locationdatasource lDataSource; Public progress pDialog = null; Fragment Manager mFragmentManager; GoogleMapOptions Options; String Address, TAG = "MyMagag"; Button btn search; Public static MyRouteFragment newInstance (LatLng status) {MyRouteFragment frag = new MyRouteFragment (); Frag.myPos = Status; Return Return; } @ Override Public View Creatives (LayoutInflator Inflator, View Group Container, Bundle Saved InstantState) {Routview = Infographic. Flatest (R.Lollout.framement_i_right, container, falls); BtnSearch = (Button) rootView.findViewById (R.id.btnSearch); EtSearchValue = (edit text) rootView.findViewById (R.id.etSearch); MFragmentManager = getFragmentManager (); MapFragment = (MapFragment) mFragmentManager.findFragmentByTag (TAG); If (mapform == empty) {mapFragment = MapFragment.newInstance (); Piece transaction piece transaction = mFragmentManager.beginTransaction (); FragmentTransaction.add (R.id.mapContainer, mapFragment, tags); FragmentTransaction.commit (); } //btnSearch.getParent().bringChildToFront (BTN Search); /*btnSearch.invalidate (); EtSearchValue.invalidate (); BtnSearch.bringToFront (); EtSearchValue.invalidate (); BtnSearch.invalidate (); * / //container.removeView (btnSearch); //container.addView (btnSearch); //container.addView(etSearchValue); // mapFragment = (mapfragment) mFragmentManager.findFragmentById (R.id.map); MapView = mapFragment.getMap (); If (mapView! = Tap) {mapView.setPadding (0, 20, 0, 0); MapView.setMyLocationEnabled (true); } BtnSearch.setOnClickListener (New OnClickListener) {@Override Click Public Zero (see V) {// TODO Auto generated method stub new getFormattedAddress (). Executed ();}}); //btnSearch.bringToFront (); //etSearchValue.bringToFront (); Return root view; }
For a start, you must call container.removeAllViews
before adding and mapfraagment
to the container
> MapFragment Dynamically in the form of all other views on the same container, in your MapFragment
container is in front of all other ideas, so you can not see them.
You can have a child FrameLayout
to insert your MapFragment
, inside your parent frame layout
. Do not forget to add android: id = "@ + id / mapContainer"
to the child frame layout
and remove it from the parent FrameLayout
. In this way, other components are going to be visible.
I should warn you that you should not load fragment
inside any other piece
, this is not recommended.
Comments
Post a Comment