3

当我在我的主题中添加背景项目时,BottomNavigationView 消失了。

@color/primary_red @color/primary_red

和底部导航视图

 <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_gravity="bottom"
        design:menu="@menu/bottom_menu_bar" />

当我从主题中删除背景项目时,它看起来像在此处输入图像描述

窗口和底栏之间有空白区域。而且背景文本也出现在前景中。如何删除它。

编辑

activity_main.xml

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

    <android.support.design.widget.AppBarLayout
        android:scrollbars="none"
        android:id="@+id/main.appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/main.collapsing"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

        //some code_1           

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


    <android.support.v7.widget.Toolbar
        android:visibility="invisible"
        android:id="@+id/main.toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:layout_anchor="@id/main.framelayout.title"
        app:theme="@style/ThemeOverlay.AppCompat.Dark"
        app:title="Dashboard">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            >

            <Space
                android:layout_width="60dp"
                android:layout_height="60dp"
                />

            <TextView
                android:id="@+id/main.textview.title"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginLeft="8dp"
                android:gravity="center_vertical"
                android:text="@string/user_name_demp"
                android:textColor="@android:color/white"
                android:textSize="20sp"
                />

        </LinearLayout>
    </android.support.v7.widget.Toolbar>

    <ImageView
        android:layout_marginBottom="@dimen/activity_horizontal_margin"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:background="@drawable/circle"
        android:id="@+id/profile_pic"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_gravity="left"
        app:layout_behavior="profile.AvatarImageBehavior"
        app:finalHeight="32dp"
        app:finalYPosition="2dp"
        app:startHeight="15dp"
        app:startToolbarPosition="10dp"
        app:startXPosition="10dp"/>



    <android.support.design.widget.BottomNavigationView
        android:background="@color/green"
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_gravity="bottom"
        design:menu="@menu/bottom_menu_bar" />



    <android.support.v4.widget.NestedScrollView
        android:fillViewport="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:layout_marginTop="@dimen/activity_horizontal_margin"
                android:textStyle="bold"
                android:textAlignment="center"
                android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                android:textColor="@color/primary_text"
                android:text="@string/health_vitals"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />



            <LinearLayout
                android:background="@color/primary_text"
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <!--First Sub Block-->
                <LinearLayout
                    android:layout_weight="1"
                    android:layout_marginRight="1sp"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <customView.healthVitalBlockDashboard
                        android:id="@+id/bp_block"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent">
                    </customView.healthVitalBlockDashboard>

                </LinearLayout>

                <!--Second Sub Block-->
                <LinearLayout
                    android:layout_weight="1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <customView.healthVitalBlockDashboard
                        android:id="@+id/bsl_block"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent">
                    </customView.healthVitalBlockDashboard>

                </LinearLayout>

            </LinearLayout>



            <TextView
                android:paddingTop="@dimen/activity_horizontal_margin"
                android:layout_marginBottom="1dp"
                android:gravity="center"
                android:textColor="@color/primary_text"
                android:textStyle="bold"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
                android:text="@string/reminder"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <android.support.v7.widget.RecyclerView
                android:id="@+id/medicine_list"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            </android.support.v7.widget.RecyclerView>

            <TextView
                android:paddingTop="8dp"
                android:paddingBottom="22dp"
                android:id="@+id/reminderWarning"
                android:visibility="gone"
                android:gravity="center"
                android:textColor="@color/primary_text"
                android:textStyle="bold"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
                android:text="@string/reminder_warning"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:paddingTop="@dimen/activity_horizontal_margin"
                android:layout_marginBottom="1dp"
                android:id="@+id/adherence_text"
                android:textStyle="bold"
                android:textAlignment="center"
                android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                android:textColor="@color/primary_text"
                android:text="@string/adherence"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <android.support.v7.widget.RecyclerView
                android:background="@color/primary_text"
                android:layout_below="@+id/adherence_text"
                android:id="@+id/action_with_adherence"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

            </android.support.v7.widget.RecyclerView>


            <TextView
                android:paddingTop="8dp"
                android:paddingBottom="22dp"
                android:id="@+id/adherence_warning"
                android:visibility="gone"
                android:gravity="center"
                android:textColor="@color/primary_text"
                android:textStyle="bold"
                android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>


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



Any leads will be helpfull!!!
4

1 回答 1

0

我正在使用此代码,它运行良好,请尝试在您的项目匹配时更改您的代码。

<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation"/>
于 2017-02-08T08:38:43.130 回答