我试图在我的Android应用程序中设计导航抽屉。 文件(drawer_activity.xml)是导航窗格。 我创建了另一个文件(activity_main_drawer.xml) 在该文件中,我已将我将要显示的所有选项放在导航窗格中 下面是(drawer_activity.xml):
(filename.dat,ListBuffer(somecaseclass("abc","1",2),somecaseclass("dse","2",3),somecaseclass("daa","1",4)))
以下是(activity_main_drawer.xml)的代码:
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer_layout"
android:fitsSystemWindows="true"
tools:openDrawer="start"
>
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<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.v4.widget.DrawerLayout>
以下是导航窗格中项目的字符串资源文件:
<?xml version="1.0" encoding="utf-8"?>
<menu 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">
<item android:title="@string/help_support">
<menu>
<item
android:id="@+id/contact_us"
android:title="@string/contact_us" />
<item
android:id="@+id/terms_conditions"
android:title="@string/terms_conditions" />
<item
android:id="@+id/help_center"
android:title="@string/help_center" />
</menu>
</item>
</menu>
我得到的错误如下:
<resource>
<!-- navigation_bar support and details -->
<string name="help_support">Help and Support</string>
<string name="contact_us">Contact Us</string>
<string name="terms_conditions">Terms and Conditions</string>
<string name="help_center">Help Center</string>
</resource>