【发布时间】:2018-09-25 14:46:19
【问题描述】:
我是一名学生,开始使用 Android Studio 编写我的课程作业。我对它比较陌生,并且一直在使用 YouTube 教程来提供帮助,其中没有太多解释。
我尝试将两者合并在一起,并且大部分都成功了,现在的问题是它告诉我需要将RecyclerView 合并到我的activitymain.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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/nav_header"
app:menu="@menu/draw_menu" />
</android.support.v4.widget.DrawerLayout>
【问题讨论】:
标签: javascript android xml