首页 > 解决方案 > 底部导航视图涵盖 MapboxMap - Android

问题描述

我尝试了许多不同的东西,但无法解决这个问题!无论我尝试什么,地图都会溢出来填满整个屏幕,导致导航栏覆盖地图的属性/底部。

我认为这可能是因为我已将 layout_behaviour 设置为在滚动时隐藏,但是删除它并不能解决问题。任何建议表示赞赏。:)

我想保留隐藏导航栏的功能,因为其他几个 viewpager 选项卡正在使用它。

主要活动

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/main_appbar"
            android:layout_height="wrap_content"
            android:layout_width="match_parent">

            <android.support.design.widget.TabLayout
                android:id="@+id/reading_tab_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll|enterAlways"
                app:tabGravity="fill"
                app:tabMaxWidth="0dp"
                app:tabMode="fixed">

                <android.support.design.widget.TabItem
                    android:id="@+id/reading1_tab"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Reading1" />

                <android.support.design.widget.TabItem
                    android:id="@+id/reading2_tab"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Reading2" />

                <android.support.design.widget.TabItem
                    android:id="@+id/reading3_tab"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Reading3" />

            </android.support.design.widget.TabLayout>

        </android.support.design.widget.AppBarLayout>

        <com.liftyourheads.dailyreadings.utils.CustomViewPager
            android:id="@+id/mainViewPager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"/>



        <android.support.design.widget.BottomNavigationView
            android:id="@+id/navigation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_marginStart="0dp"
            android:layout_marginEnd="0dp"
            android:background="?android:attr/windowBackground"
            app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
            app:menu="@menu/navigation"/>
            <!--app:layout_anchorGravity="bottom"-->
            <!--app:layout_anchor="@+id/mainViewPager"-->

    </android.support.design.widget.CoordinatorLayout>

分段

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:mapbox="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.liftyourheads.dailyreadings.activities.MainActivity"
    android:id="@+id/map_fragment_root_id">
    <!--android:layout_marginBottom="200dp"-->


    <com.mapbox.mapboxsdk.maps.MapView
        android:id="@+id/bibleMapView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        mapbox:mapbox_cameraTargetLat="40.73581"
        mapbox:mapbox_cameraTargetLng="-73.99155"
        mapbox:mapbox_styleUrl="@string/mapbox_style_custom_bible"/>


    <FrameLayout
        android:id="@+id/mapOverlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:alpha="0.5"
        android:background="@android:color/background_dark"
        android:visibility="invisible" />

</android.support.design.widget.CoordinatorLayout>

标签: androidbottomnavigationviewmapbox-android

解决方案


推荐阅读