1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2015 The Android Open Source Project
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8          http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15-->
16
17<!--
18    A DrawerLayout is indended to be used as the top-level content view
19    using match_parent for both width and height to consume the full space available.
20    See https://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-specs
21    for the full spec of a drawer in Material design.
22-->
23<androidx.drawerlayout.widget.DrawerLayout
24    xmlns:android="http://schemas.android.com/apk/res/android"
25    android:id="@+id/drawer_layout"
26    android:layout_width="match_parent"
27    android:layout_height="match_parent"
28    android:fitsSystemWindows="true">
29    <!-- As the main content view, the view below consumes the entire
30         space available using match_parent in both dimensions. Note that
31         this child does not specify android:layout_gravity attribute. -->
32    <LinearLayout
33        android:id="@+id/content"
34        android:layout_width="match_parent"
35        android:layout_height="match_parent"
36        android:orientation="vertical">
37        <!-- This will be set as the support action bar of the activity at runtime.
38             It needs to be a dynamic runtime call for correct vertical layering of
39             the drawer and the toolbar. -->
40        <androidx.appcompat.widget.Toolbar
41            android:id="@+id/toolbar"
42            android:layout_width="match_parent"
43            android:layout_height="?attr/actionBarSize" />
44
45        <ScrollView
46            android:layout_width="match_parent"
47            android:layout_height="match_parent"
48            android:scrollbarStyle="outsideOverlay">
49            <TextView
50                android:id="@+id/content_text"
51                android:layout_width="match_parent"
52                android:layout_height="match_parent"
53                android:text="@string/drawer_layout_summary"
54                android:textAppearance="?android:attr/textAppearanceMedium"
55                android:padding="16dp"/>
56        </ScrollView>
57    </LinearLayout>
58
59    <!-- android:layout_gravity="start" tells DrawerLayout to treat
60         this as a sliding drawer on the starting side, which is
61         left for left-to-right locales. The drawer is given arbitrary
62         initial width and extends the full height of the container. A
63         solid background is used for contrast with the content view.
64         android:fitsSystemWindows="true" tells the system to have
65         DrawerLayout span the full height of the screen, including the
66         system status bar on Lollipop+ versions of the plaform. The actual
67         width of drawer will be determined at runtime based on the screen
68         size according to the Material spec. -->
69    <ListView
70            android:id="@+id/start_drawer"
71            android:layout_width="wrap_content"
72            android:layout_height="match_parent"
73            android:layout_gravity="start"
74            android:background="#333333"
75            android:fitsSystemWindows="true"/>
76
77    <!-- android:layout_gravity="end" tells DrawerLayout to treat
78         this as a sliding drawer on the ending side, which is
79         right for left-to-right locales. The drawer is given arbitrary
80         initial width and extends the full height of the container. A
81         solid background is used for contrast with the content view.
82         The actual width of drawer will be determined at runtime based on
83         the screen size according to the Material spec. -->
84    <FrameLayout
85            android:id="@+id/end_drawer"
86            android:layout_width="wrap_content"
87            android:layout_height="match_parent"
88            android:layout_gravity="end"
89            android:background="#808080"/>
90</androidx.drawerlayout.widget.DrawerLayout>
91
92