<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2013 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- A SlidingPaneLayout is indended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> <android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/sliding_pane_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- The first child view becomes the left pane. When the combined desired width (expressed using android:layout_width) would not fit on-screen at once, the right pane is permitted to overlap the left. --> <ListView android:id="@+id/left_pane" android:layout_width="280dp" android:layout_height="match_parent" android:layout_gravity="left"/> <!-- The second child becomes the right (content) pane. In this example, android:layout_weight is used to express that this pane should grow to consume leftover available space when the window is wide enough. This allows the content pane to responsively grow in width on larger screens while still requiring at least the minimum width expressed by android:layout_width. --> <ScrollView android:layout_width="300dp" android:layout_height="match_parent" android:layout_weight="1" android:paddingLeft="16dp" android:paddingRight="16dp" android:scrollbarStyle="outsideOverlay" android:background="#ff333333"> <TextView android:id="@+id/content_text" android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/sliding_pane_layout_summary" android:textAppearance="?android:attr/textAppearanceMedium"/> </ScrollView> </android.support.v4.widget.SlidingPaneLayout>