I'm having problems displaying a TextView over my Google Map. I add the MapFragment programmatically in a FrameLayout during onCreate method and the TextView is in the XML file. For what I can see, the TextView is properly displayed but the MapFragment comes over it and hides the TextView when it is added to the FrameLayout. I already searched here on StackOverflow but every akin topic I could find was with a static MapFragment in XML.
here is my code : src/java/SearchMapFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
...
mMapFragment = MapFragment.newInstance(options);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.map_layout,mMapFragment);
fragmentTransaction.commit();
((TextView)rootView.findViewById(R.id.map_label)).setVisibility(View.VISIBLE);
...
}
and my XML fil : res/layout/fragment_search_map.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/search_map_wrapper_layout"
tools:context="com.appsolute.ParkYoo.SearchMapFragment">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/map_layout"
android:layout_weight="100">
<TextView style="@style/DarkBlueText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/map_label"
android:gravity="center"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:visibility="gone"/>
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/search_map_frame_layout">
<Button style="@style/WhiteText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Lancer la recherche"
android:layout_margin="5dp"
android:id="@+id/launch_search"
android:background="@drawable/lancer" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
Any help would be greatly appreciated thanks in advance !