与往常一样,没有明确而准确的指示。我正在尝试将滑动菜单附加到一个空项目,但我遇到了一个问题:
error: attribute menu (aka com.example.main_rfid_test:menu) not found.
尽管在带有拉出菜单的项目模板中,一切都完全相同并且可以正常工作。我不明白为什么我没有参数,但模板有:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<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:menu="@menu/navigate_menu.xml"
/>
</android.support.v4.widget.DrawerLayout>
navigate_menu 位于菜单目录中。
bild.grad: // 顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
res图片中,文件就位,什么都看不懂:
在这种情况下,您需要包含库
design