我正在尝试向Android Studio中的现有项目添加导航菜单.但是,按照官方网站上的说明,我<android.support.v4.widget.DrawerLayout ...在我的视图的其余部分添加了一个标记,并在主要活动布局的主ConstraintLayout下,我将示例导航绘制放在其下面:
<android.support.design.widget.NavigationView
        android:id="@+id/navigation"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:menu="@menu/my_navigation_items" />
Run Code Online (Sandbox Code Playgroud)
最后一行在构建时会导致一些问题:
Error:error: attribute 'com. ... :menu' not found.
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么会这样.所述app的部分app:menu中的DrawerLayout标签中定义为:xmlns:app="http://schemas.android.com/apk/res-auto"
这似乎也会导致Cannot resolve symbol R我的MainActivity.java文件中出现错误.
无论如何,非常感谢任何帮助!