Home | History | Annotate | Download | only in layout
      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 -->
     21 <android.support.v7.custom.CustomDrawerLayout
     22     xmlns:android="http://schemas.android.com/apk/res/android"
     23     android:id="@+id/drawer_layout"
     24     android:layout_width="match_parent"
     25     android:layout_height="match_parent"
     26     android:fitsSystemWindows="true">
     27     <!-- As the main content view, the view below consumes the entire
     28          space available using match_parent in both dimensions. Note that
     29          this child does not specify android:layout_gravity attribute. -->
     30     <LinearLayout
     31         android:id="@+id/content"
     32         android:layout_width="match_parent"
     33         android:layout_height="match_parent"
     34         android:orientation="vertical">
     35         <!-- This will be set as the support action bar of the activity at runtime.
     36              It needs to be a dynamic runtime call for correct vertical layering of
     37              the drawer and the toolbar. -->
     38         <android.support.v7.widget.Toolbar
     39             android:id="@+id/toolbar"
     40             android:layout_width="match_parent"
     41             android:layout_height="?attr/actionBarSize" />
     42 
     43         <ScrollView
     44             android:layout_width="match_parent"
     45             android:layout_height="match_parent"
     46             android:scrollbarStyle="outsideOverlay">
     47             <TextView
     48                 android:id="@+id/content_text"
     49                 android:layout_width="match_parent"
     50                 android:layout_height="match_parent"
     51                 android:text="@string/drawer_layout_summary"
     52                 android:textAppearance="?android:attr/textAppearanceMedium"
     53                 android:padding="16dp"/>
     54         </ScrollView>
     55     </LinearLayout>
     56 
     57     <!-- android:layout_gravity="start" tells DrawerLayout to treat
     58          this as a sliding drawer on the starting side, which is
     59          left for left-to-right locales. The drawer is given a fixed
     60          width in dp and extends the full height of the container. A
     61          solid background is used for contrast with the content view.
     62          android:fitsSystemWindows="true" tells the system to have
     63          DrawerLayout span the full height of the screen, including the
     64          system status bar on Lollipop+ versions of the plaform. -->
     65     <ListView
     66             android:id="@+id/start_drawer"
     67             android:layout_width="300dp"
     68             android:layout_height="match_parent"
     69             android:layout_gravity="start"
     70             android:background="#ff333333"
     71             android:fitsSystemWindows="true"/>
     72 </android.support.v7.custom.CustomDrawerLayout>
     73 
     74