navigationdrawer Android文档和navigationDrawerActivity之间的差异
我想实现一个导航抽屉,并试图了解它是如何工作的。我已经测试了navigationDrawerActivity,我们可以在Android Studio中使用activity_main进行选择,如下所示:navigationdrawer Android文档和navigationDrawerActivity之间的差异,android,android-studio,navigation-drawer,material-design,android-design-library,Android,Android Studio,Navigation Drawer,Material Design,Android Design Library,我想实现一个导航抽屉,并试图了解它是如何工作的。我已经测试了navigationDrawerActivity,我们可以在Android Studio中使用activity_main进行选择,如下所示: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?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">
<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>
,主要活动是:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
所以我不明白为什么android studio和doc有什么不同。你能告诉我为什么会有这种差异吗?文档使用fragment,而android studio活动不使用。文档只是提供了一种方法来演示如何简单地使用DrawerLayout
工作,因此您将学习如何使用创建抽屉、处理导航单击和打开/关闭抽屉等基本功能
来自Android Studio的activity\u main
不仅如此,它还为你的应用程序带来了一些素材设计。像NavigationView
,AppBarLayout
之类的东西,它们都来自。但是DrawerLayout
的用法大致相同。该文档只是提供了一种方法来演示DrawerLayout
的工作原理,因此您将学习如何使用创建抽屉、处理导航单击和打开/关闭抽屉等基本功能
来自Android Studio的activity\u main
不仅如此,它还为你的应用程序带来了一些素材设计。像NavigationView
,AppBarLayout
之类的东西,它们都来自。但是DrawerLayout
的用法大致相同
所以我不明白为什么android studio和doc有什么不同
Android Studio中使用的模板比未更新的文档更新。
有了新功能,您可以在抽屉布局中使用导航视图
,以非常简单的方式实现如下导航抽屉
你能告诉我为什么会有这种差异吗
唯一的区别是使用了导航视图
而不是列表视图。
当然,您可以在抽屉布局中使用所需内容
所以我不明白为什么android studio和doc有什么不同
Android Studio中使用的模板比未更新的文档更新。
有了新功能,您可以在抽屉布局中使用导航视图
,以非常简单的方式实现如下导航抽屉
你能告诉我为什么会有这种差异吗
唯一的区别是使用了导航视图
而不是列表视图。
当然,您可以在抽屉布局中使用所需内容 谢谢你的链接,我不知道android Blogspot谢谢你的链接,我不知道android Blogspot谢谢,我认为android开发者是最新的谢谢,我认为android开发者是最新的