Q:

Problem positionning buttons under a google map fragment in a bottom navigation layout

I have an app that has bottom navigation with three tabs. On one of the screen of the app I have a Google Map fragment. I wish to show three buttons under the map fragment and above the bottom navigation for this screen only.
When I'm in the designer for this specific fragment, it shows what I want (here the grey "fragment" is in fact the Google Map fragment)
You can download the code from github : https://github.com/guyprovost/BottomBug/tree/master

But when I run the app, this is what I got:

I was aiming at this end result, (sorry for the poorly draw explanation of the desired result, but you get the idea!)

Here's the fragment layout : 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    class="com.google.android.gms.maps.MapFragment"
    android:layout_marginTop="24dp" />
<LinearLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/controlBar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:background="@color/primaryDark"
    android:gravity="bottom">
    <Button
        android:id="@+id/testbutton1"
        android:text="One"
        android:layout_width = "wrap_content"
        android:layout_height = "wrap_content"
        android:layout_weight=".30"/>
    <Button
        android:id="@+id/testbutton2"
        android:text="Two" 
        android:layout_width = "wrap_content"
        android:layout_height = "wrap_content"
        android:layout_weight=".40" />
    <Button
        android:id="@+id/testbutton3"
        android:text="Three" 
        android:layout_width = "wrap_content"
        android:layout_height = "wrap_content"
        android:layout_weight=".30" />
</LinearLayout>

Here's the main activity layout file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/bottom_navigation" />
    <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_gravity="start"
        android:layout_alignParentBottom="true"
        android:background="@android:color/white"
        app:elevation="16dp"
        app:menu="@menu/bottom_navigation_main" />
</RelativeLayout>

And here's the bottom navigation menu xml file content :
    <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/menu_map"
        android:enabled="true"
        android:icon="@drawable/ic_map"
        android:title="@string/tab1_title"
        app:showAsAction="ifRoom" />

    <item
        android:id="@+id/menu_history"
        android:enabled="true"
        android:icon="@drawable/ic_history"
        android:title="@string/tab2_title"
        app:showAsAction="ifRoom" />

    <item
        android:id="@+id/menu_settings"
        android:enabled="true"
        android:icon="@drawable/ic_settings"
        android:title="@string/tab3_title"
        app:showAsAction="ifRoom" />
</menu>

I looks like that either the map fragment height can't be properly manipulated at runtime or it can't be used like that in a bottom navigation layout... Or that I goofed miserably somewhere, which is higly possible.
Any clues ?

A:

if i understood your query properly then let me give you a solution that can you use relative layout instead of linear layout like below and also let me tell you that i'm understanding that you need your navigation view in main activity as well you need three buttons on top of navigation view and on top of that you need map fragment. right? so here is the solution:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_above="@+id/controlBar"
        class="com.google.android.gms.maps.MapFragment"
        android:layout_marginTop="24dp" />
    <LinearLayout
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/controlBar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_alignParentBottom="true"
        android:background="@color/primaryDark"
        android:gravity="bottom">
        <Button
            android:id="@+id/testbutton1"
            android:text="One"
            android:layout_width = "wrap_content"
            android:layout_height = "wrap_content"
            android:layout_weight=".30"/>
        <Button
            android:id="@+id/testbutton2"
            android:text="Two" 
            android:layout_width = "wrap_content"
            android:layout_height = "wrap_content"
            android:layout_weight=".40" />
        <Button
            android:id="@+id/testbutton3"
            android:text="Three" 
            android:layout_width = "wrap_content"
            android:layout_height = "wrap_content"
            android:layout_weight=".30" />
    </LinearLayout>

 

