Skip to content

Commit b105894

Browse files
adampAndroid Git Automerger
authored andcommitted
am 2622ae2: am 98c5d4a: Add Support4Demos examples for DrawerLayout and SlidingPaneLayout
* commit '2622ae27adefc16299deb611dc040bec5ad59c73': Add Support4Demos examples for DrawerLayout and SlidingPaneLayout
2 parents 7f3dab1 + 2622ae2 commit b105894

File tree

12 files changed

+601
-1
lines changed

12 files changed

+601
-1
lines changed

samples/Support4Demos/AndroidManifest.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<uses-permission android:name="android.permission.READ_CONTACTS" />
2626

27-
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
27+
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
2828

2929
<!-- The smallest screen this app works on is a phone. The app will
3030
scale its UI to larger screens but doesn't make good use of them
@@ -276,6 +276,22 @@
276276
</intent-filter>
277277
</activity>
278278

279+
<activity android:name=".widget.DrawerLayoutActivity"
280+
android:label="@string/drawer_layout_support">
281+
<intent-filter>
282+
<action android:name="android.intent.action.MAIN" />
283+
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
284+
</intent-filter>
285+
</activity>
286+
287+
<activity android:name=".widget.SlidingPaneLayoutActivity"
288+
android:label="@string/sliding_pane_layout_support">
289+
<intent-filter>
290+
<action android:name="android.intent.action.MAIN" />
291+
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
292+
</intent-filter>
293+
</activity>
294+
279295
<provider android:authorities="com.example.supportv4.content.sharingsupportprovider"
280296
android:name=".content.SharingSupportProvider" />
281297

171 Bytes
Loading
2.78 KB
Loading
158 Bytes
Loading
2.77 KB
Loading
182 Bytes
Loading
1.03 KB
Loading
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2013 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.v4.widget.DrawerLayout
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+
<!-- As the main content view, the view below consumes the entire
27+
space available using match_parent in both dimensions. -->
28+
<ScrollView
29+
android:layout_width="match_parent"
30+
android:layout_height="match_parent"
31+
android:paddingLeft="16dp"
32+
android:paddingRight="16dp"
33+
android:scrollbarStyle="outsideOverlay">
34+
<TextView android:id="@+id/content_text"
35+
android:layout_width="match_parent"
36+
android:layout_height="match_parent"
37+
android:text="@string/drawer_layout_summary"
38+
android:textAppearance="?android:attr/textAppearanceMedium"/>
39+
</ScrollView>
40+
<!-- android:layout_gravity="left" tells DrawerLayout to treat
41+
this as a sliding drawer on the left side. The drawer is
42+
given a fixed width in dp and extends the full height of
43+
the container. A solid background is used for contrast
44+
with the content view. -->
45+
<ListView android:id="@+id/left_drawer"
46+
android:layout_width="300dp"
47+
android:layout_height="match_parent"
48+
android:layout_gravity="left"
49+
android:background="#ff333333"/>
50+
</android.support.v4.widget.DrawerLayout>
51+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2013 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 SlidingPaneLayout 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.v4.widget.SlidingPaneLayout
22+
xmlns:android="http://schemas.android.com/apk/res/android"
23+
android:id="@+id/sliding_pane_layout"
24+
android:layout_width="match_parent"
25+
android:layout_height="match_parent">
26+
<!-- The first child view becomes the left pane. When the combined
27+
desired width (expressed using android:layout_width) would
28+
not fit on-screen at once, the right pane is permitted to
29+
overlap the left. -->
30+
<ListView android:id="@+id/left_pane"
31+
android:layout_width="280dp"
32+
android:layout_height="match_parent"
33+
android:layout_gravity="left"/>
34+
<!-- The second child becomes the right (content) pane. In this
35+
example, android:layout_weight is used to express that this
36+
pane should grow to consume leftover available space when the
37+
window is wide enough. This allows the content pane to
38+
responsively grow in width on larger screens while still
39+
requiring at least the minimum width expressed by
40+
android:layout_width. -->
41+
<ScrollView
42+
android:layout_width="300dp"
43+
android:layout_height="match_parent"
44+
android:layout_weight="1"
45+
android:paddingLeft="16dp"
46+
android:paddingRight="16dp"
47+
android:scrollbarStyle="outsideOverlay"
48+
android:background="#ff333333">
49+
<TextView android:id="@+id/content_text"
50+
android:layout_width="match_parent"
51+
android:layout_height="match_parent"
52+
android:text="@string/sliding_pane_layout_summary"
53+
android:textAppearance="?android:attr/textAppearanceMedium"/>
54+
</ScrollView>
55+
</android.support.v4.widget.SlidingPaneLayout>
56+

samples/Support4Demos/res/values/strings.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,15 @@
134134
<string name="sharing_support_title">ShareCompat Demo</string>
135135
<string name="sharing_receiver_title">ShareCompat Receiver</string>
136136

137+
<string name="drawer_layout_support">Widget/Drawer layout</string>
138+
139+
<string name="drawer_layout_summary">This activity illustrates the use of sliding drawers. The drawer may be pulled out from the left edge with an edge swipe. If this demo is running on Ice Cream Sandwich or newer you may tap the icon at the left side of the action bar to open the drawer as well.</string>
140+
141+
<string name="drawer_open">Open navigation drawer</string>
142+
<string name="drawer_close">Close navigation drawer</string>
143+
144+
<string name="sliding_pane_layout_support">Widget/Sliding pane layout</string>
145+
146+
<string name="sliding_pane_layout_summary">This activity illustrates the use of sliding panes. The content pane may be slid to one side on narrow devices to reveal the left pane used to select content. Sliding panes can be used to fit a UI intended for wider screens in a smaller space. Tapping the Action Bar\'s Up button at the left side of the bar will navigate up in the hierarchy, represented by the left pane. If you rotate the device to landscape mode, on most devices you will see that both panes fit together side by side with no sliding necessary.</string>
147+
137148
</resources>

0 commit comments

Comments
 (0)