Skip to content

Latest commit

 

History

History
182 lines (123 loc) · 9.22 KB

File metadata and controls

182 lines (123 loc) · 9.22 KB

Nested Scroll Layout

  • Project address: Github

  • Click here to download demo apk directly

  • As we all know, WebView, LinearLayout, FrameLayout, and RelativeLayout do not support the NestedScroll feature, so this library was created specifically to solve this problem.

Integration Steps

  • If your project's Gradle version is below 7.0, you need to add the following to the build.gradle file:
allprojects {
    repositories {
        // JitPack remote repository: https://jitpack.io
        maven { url 'https://jitpack.io' }
    }
}
  • If your Gradle version is 7.0 or above, you need to add the following to the settings.gradle file:
dependencyResolutionManagement {
    repositories {
        // JitPack remote repository: https://jitpack.io
        maven { url 'https://jitpack.io' }
    }
}
  • After configuring the remote repository, add the remote dependency in the build.gradle file under the app module:
android {
    // Supports JDK 1.8 and above
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    // Nested Scroll Layout: https://github.com/getActivity/NestedScrollLayout
    implementation 'com.github.getActivity:NestedScrollLayout:3.0'
}
  • Option 1: Use remote dependencies of the old version framework
dependencies {
    // Nested Scroll Layout: https://github.com/getActivity/NestedScrollLayout
    implementation 'com.github.getActivity:NestedScrollLayout:2.0'
}
  • Option 2: If your project is still in the Support phase and it's not convenient to migrate to AndroidX yet, but you want to use the latest version of the framework, you can use the JetifierStandalone tool provided by Google to convert the aar packages from the released Release versions into Support-compatible aar packages using reverse mode.

  • You can choose either of the above two options, but it's still not recommended. These are only stopgap measures, not long-term solutions. Subsequent versions of the framework will no longer support Support projects. The best approach is to migrate your project to AndroidX.

Framework Usage

  • NestedScrollWebView
<com.hjq.nested.scroll.layout.NestedScrollWebView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
  • NestedScrollFrameLayout
<com.hjq.nested.scroll.layout.NestedScrollFrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    
</com.hjq.nested.scroll.layout.NestedScrollFrameLayout>
  • NestedScrollLinearLayout
<?xml version="1.0" encoding="utf-8"?>
<com.hjq.nested.scroll.layout.NestedScrollLinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

</com.hjq.nested.scroll.layout.NestedScrollLinearLayout>
  • NestedScrollRelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<com.hjq.nested.scroll.layout.NestedScrollRelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</com.hjq.nested.scroll.layout.NestedScrollRelativeLayout>
  • NestedScrollViewPager
<com.hjq.nested.scroll.layout.NestedScrollViewPager
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

Open Source Project List

License

Copyright 2018 Huang JinQun

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.