am 57d28dab: Add sample for nested scrolling

* commit '57d28dab0e11ab5bc7c3220a6b3522bd94f6b1a0':
  Add sample for nested scrolling
This commit is contained in:
Adam Powell
2015-01-30 19:34:16 +00:00
committed by Android Git Automerger
4 changed files with 100 additions and 0 deletions

View File

@@ -351,6 +351,14 @@
</intent-filter>
</activity>
<activity android:name=".widget.NestedScrollActivity"
android:label="@string/nested_scroll">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<!-- BEGIN_INCLUDE(file_provider_declaration) -->
<provider
android:name="android.support.v4.content.FileProvider"

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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 NestedScrollView behaves like a ScrollView, but it can be placed into
other nested scrolling containers or have other nested scrolling containers
placed into it.
-->
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearance"
android:text="@string/nested_scroll_long_text" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="200dp"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearance"
android:text="@string/nested_scroll_long_text" />
</android.support.v4.widget.NestedScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearance"
android:text="@string/nested_scroll_long_text" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

View File

@@ -184,4 +184,9 @@
<!-- Swipe refresh -->
<string name="swipe">Widget/SwipeRefreshLayout</string>
<string name="nested_scroll">Widget/Nested Scrolling</string>
<string name="nested_scroll_long_text">This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it. This is some long text. It just keeps going. Look at it. Scroll it. Scroll the nested version of it.</string>
</resources>

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2015 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.supportv4.widget;
import android.app.Activity;
import android.os.Bundle;
import com.example.android.supportv4.R;
/**
* This activity demonstrates the use of nested scrolling in the v4 support library.
* See the associated layout file for details.
*/
public class NestedScrollActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.nested_scroll);
}
}