Use of bottom sheet with ScrollView in background

Bug: 26237244
Change-Id: I79d500ce1262021368aeb4693246bbc6bba8c6e7
diff --git a/samples/SupportDesignDemos/AndroidManifest.xml b/samples/SupportDesignDemos/AndroidManifest.xml
index 026d090..920fd22 100644
--- a/samples/SupportDesignDemos/AndroidManifest.xml
+++ b/samples/SupportDesignDemos/AndroidManifest.xml
@@ -235,6 +235,15 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".widget.BottomSheetScrollView"
+                  android:label="@string/design_bottomsheet_scroll"
+                  android:theme="@style/Theme.Design">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.example.android.support.design.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".widget.BottomSheetModal"
                   android:label="@string/design_bottomsheet_modal"
                   android:theme="@style/Theme.BottomSheetModal">
diff --git a/samples/SupportDesignDemos/res/layout/design_bottom_sheet_scroll.xml b/samples/SupportDesignDemos/res/layout/design_bottom_sheet_scroll.xml
new file mode 100644
index 0000000..7b3da9f
--- /dev/null
+++ b/samples/SupportDesignDemos/res/layout/design_bottom_sheet_scroll.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2016 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.
+-->
+<android.support.design.widget.CoordinatorLayout
+        android:id="@+id/coordinator"
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:app="http://schemas.android.com/apk/res/com.example.android.support.design"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+    <ScrollView
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+
+        <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:padding="16dp">
+
+            <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/bottomsheet_scroll"
+                    style="@style/TextAppearance.AppCompat.Headline"/>
+
+            <TextView
+                    android:id="@+id/dialogue_background"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="16dp"
+                    style="@style/TextAppearance.AppCompat.Body1"/>
+
+        </LinearLayout>
+
+    </ScrollView>
+
+    <!--
+        This is the bottom sheet. You can use any View as a bottom sheet by marking it with
+        app:layout_behavior as BottomSheetBehavior.
+    -->
+    <LinearLayout
+            android:id="@+id/bottom_sheet"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginLeft="@dimen/bottom_sheet_horizontal_margin"
+            android:layout_marginRight="@dimen/bottom_sheet_horizontal_margin"
+            android:background="?android:attr/windowBackground"
+            android:elevation="@dimen/bottom_sheet_elevation"
+            android:minHeight="@dimen/bottom_sheet_peek_height"
+            android:orientation="vertical"
+            app:layout_behavior="@string/bottom_sheet_behavior"
+            app:behavior_peekHeight="@dimen/bottom_sheet_peek_height">
+
+        <include layout="@layout/include_bottom_sheet"/>
+
+    </LinearLayout>
+
+</android.support.design.widget.CoordinatorLayout>
diff --git a/samples/SupportDesignDemos/res/values/strings.xml b/samples/SupportDesignDemos/res/values/strings.xml
index 3903499..505dec0 100644
--- a/samples/SupportDesignDemos/res/values/strings.xml
+++ b/samples/SupportDesignDemos/res/values/strings.xml
@@ -24,6 +24,7 @@
     <string name="design_text_input">Text Input</string>
     <string name="design_bottomsheet_persistent">BottomSheet/Persistent</string>
     <string name="design_bottomsheet_hideable">BottomSheet/Hideable</string>
+    <string name="design_bottomsheet_scroll">BottomSheet/With ScrollView in background</string>
     <string name="design_bottomsheet_modal">BottomSheet/Modal</string>
 
     <string name="fab_size_normal">Normal size</string>
@@ -89,6 +90,7 @@
     <string name="bottom_sheet">Bottom sheet</string>
     <string name="bottomsheet_persistent">Persistent</string>
     <string name="bottomsheet_hideable">Hideable</string>
+    <string name="bottomsheet_scroll">With ScrollView</string>
     <string name="bottomsheet_modal">Modal</string>
     <string name="bottomsheet_hide">Hide</string>
     <string name="bottomsheet_show">Show</string>
diff --git a/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomSheetScrollView.java b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomSheetScrollView.java
new file mode 100644
index 0000000..64eb5b5
--- /dev/null
+++ b/samples/SupportDesignDemos/src/com/example/android/support/design/widget/BottomSheetScrollView.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+package com.example.android.support.design.widget;
+
+import com.example.android.support.design.R;
+import com.example.android.support.design.Shakespeare;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.text.TextUtils;
+import android.widget.TextView;
+
+public class BottomSheetScrollView extends BottomSheetUsageBase {
+
+    @Override
+    protected int getLayoutId() {
+        return R.layout.design_bottom_sheet_scroll;
+    }
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        ((TextView) findViewById(R.id.dialogue_background))
+                .setText(TextUtils.concat(Shakespeare.DIALOGUE));
+    }
+
+}