错误:(86,48)错误:找不到符号变量navigation_drawer_open

时间:2016-12-31 06:02:56

标签: java android android-studio

我正在尝试为我的应用创建导航栏,但我突然收到此错误消息。我还收到了一条发现周期链的错误消息:activity_item_list包括app_bar_main包括activity_item_list 顺便说一句,navigation_drawer_open的id在strings.xml中,但我仍然收到错误消息。任何帮助都将很高兴。

strings.xml

<resources>
    <string name="navigation_drawer_open">Open navigation drawer</string>
    <string name="navigation_drawer_close">Close navigation drawer</string>
</resources>

app_bar_main.xml

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

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

<include layout="@layout/activity_item_list" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    app:srcCompat="@android:drawable/ic_dialog_email" />

activity_main_list.xml

    

<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    app:menu="@menu/activity_main_drawer" />


<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:background="?attr/colorPrimaryDark"
        android:layout_width="match_parent"
        android:layout_height="72dp"
        android:fitsSystemWindows="true"
        app:popupTheme="@style/Theme.AppCompat.DayNight.DarkActionBar" />

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

<FrameLayout
    android:id="@+id/frameLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <EditText
            android:id="@+id/search_box"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp"
            android:paddingLeft="8dp"
            android:paddingBottom="12dp"
            android:paddingTop="12dp"
            android:textSize="14sp"
            android:hint="@string/search_hint"
            android:background="@drawable/bottom_border"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true" />

        <include
            layout="@layout/item_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/relativeAd"
            android:layout_below="@+id/search_box" />

        <LinearLayout
            android:id="@+id/relativeAd"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:background="@color/divider"
            android:gravity="center"
            android:orientation="vertical">
        </LinearLayout>
    </RelativeLayout>
</FrameLayout>

1 个答案:

答案 0 :(得分:0)

您必须添加以下内容strings.xml文件。

<string name="navigation_drawer_open">Drawer Open</string>
<string name="navigation_drawer_close">Drawer Closed</string>