BottomNavigationView未显示

时间:2017-02-08 08:12:46

标签: android bottom-sheet bottomnavigationview

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

@颜色/ primary_red @颜色/ primary_red

和bottomnavigationview

 <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" />

当我从主题中删除背景项时,它看起来像enter image description here

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

修改

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!!!

1 个答案:

答案 0 :(得分:0)

我正在使用此代码并且效果很好,尝试在项目匹配时更改您的代码。

function myFunction() {
    var answer = document.getElementById("radioBtn").checked;


  document.getElementById("value").innerHTML = answer;
}