Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.didikk:sticky-nestedscrollview:1.0.1'
}
<dependency>
<groupId>com.github.didikk</groupId>
<artifactId>sticky-nestedscrollview</artifactId>
<version>1.0.1</version>
</dependency>
libraryDependencies += "com.github.didikk" % "sticky-nestedscrollview" % "1.0.1"
:dependencies [[com.github.didikk/sticky-nestedscrollview "1.0.1"]]
Upgraded version from StickyScrollView
Add the following gradle dependency
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.didikk:sticky-nestedscrollview:1.0.1'
}
Add android:tag="sticky" to your desired view.
<me.didik.component.StickyNestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="me.didik.stickynestedscrollview.MainActivity"
tools:showIn="@layout/activity_main">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/activity_horizontal_margin">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:tag="sticky"
android:text="@string/sample"
android:textColor="@color/colorAccent"
android:textSize="18sp"/>
// Other view
</LinearLayout>
</me.didik.component.StickyNestedScrollView>