Merge "Use of bottom sheet with ScrollView in background" into mnc-ub-dev

am: 8abd4451a9

* commit '8abd4451a9beb36c299212389693a8134350c1cd':
  Use of bottom sheet with ScrollView in background
This commit is contained in:
Yuichi Araki
2016-01-14 03:45:03 +00:00
committed by android-build-merger
4 changed files with 124 additions and 0 deletions

View File

@@ -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">

View File

@@ -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>

View File

@@ -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>

View File

@@ -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));
}
}