When scrolling within Bottom Sheet Dialog(BSD), unexpected behavior occurs when scrolling behavior is implemented using ScrollView or NestedScrollView. This library helps to avoid disrupting the basic behavior of scroll views in the dialog by dragging BSD only through the drag handle specified by the user.
settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
build.gradle(app)
dependencies {
implementation 'com.github.tentenacy:DragHandleBottomSheet:1.0.0'
}
In onViewCreated of your BottomSheetDialogFragment
makeDraggableByHandle(
dragHandle = view, //(required)specifies the view that you want to drag
scrollVerticalRatio = 0.45f, //(optional)sets the critical percentage at which the BSD disappears or expands
animatorDuration = 300L, //(optional)sets the time (ms) of the animation to be executed
// when the height of the BSD is greater than the scrollVerticalRatio and expanded
interpolatorFactor = 2f, //(optional)sets the factor of DecelerateInterpolator
)
For full example, please refer to the DragHandleBottomSheetExample
app.
Also you can browse the issue labeled as question here
Apache 2.0 License