Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

ComposeScrollbars: Polish your Android Compose UI with advanced scrollbars

License

NotificationsYou must be signed in to change notification settings

GIGAMOLE/ComposeScrollbars

Repository files navigation

|Setup Guide|Report new issue

ComposeScrollbars

TheComposeScrollbars is a feature-rich Android Compose UI library that seamlessly incorporates customisable scrollbars, including size, animations, background/knob layer style, and scroll behavior, for a seamless UX.

Features:

  • Advanced Customization: Customize scrollbar size, orientation, gravity and visibility animation.
  • Layers Configuration: Configure background and knob layers with style, appearance and animation.
  • Knob Scroll Behavior: Choose from static, worm, fraction, or exact scroll behaviors for the knob.
  • Scrolls States: Ready forScrollState,LazyListState,LazyGridState,LazyStaggeredGridState.
  • Custom Content: Design custom backgrounds and knobs when required.
  • Sample App: Explore and experiment withsample app.

Sample App

Sample 1Sample 2Sample 3
Sample 4Sample 5Sample 6

Download or clone this repository to discover the sample app.

Setup

Add to the rootbuild.gradle.kts:

allprojects {    repositories {...        maven("https://jitpack.io")    }}

Add to the packagebuild.gradle.kts:

dependencies {    implementation("com.github.GIGAMOLE:ComposeScrollbars:{latest-version}")}

Latest version:.

Also, it's possible to download the latest artifact from thereleases page.

Guide

TheComposeScrollbars comes with the main component:Scrollbars.

For more technical and detailed documentation, read the libraryKDoc.

Scrollbars

TheScrollbars presents scrollbars based on the providedScrollbarsState.

Just place it above (Z-order) of your scrollable content so its visible.

ScrollbarsState

TheScrollbarsState consists of two required components:ScrollbarsConfig andScrollbarsScrollType.

To create aScrollbarsState, use one of the utility functions:rememberScrollbarsState(...) or make it on your own.

ScrollbarsConfig

TheScrollbarsConfig setups the scrollbars layouts, styles and appearances:

ParamDescription
orientationThe scrollbars orientation:Horizontal orVertical.
gravityThe scrollbars gravity:Start orEnd.
isReverseLayoutThe scrollbars reverse layout indicator.
paddingValuesThe scrollbars layers container padding values.
sizeTypeThe scrollbars layers container size:Full,Fraction orExact.
layersTypeTheScrollbarsLayersType.
backgroundLayerContentTypeThe backgroundScrollbarsLayerContentType.
knobLayerContentTypeThe knobScrollbarsLayerContentType.
visibilityTypeTheScrollbarsVisibilityType.
ScrollbarsLayersType

TheScrollbarsLayersType can be one of the following:

  • Wrap: Wraps a knob layer into a background layer. The layers are centered.
  • Split: Splits a knob and a background layer into each own configurable layer.

Each mode can set layers thickness(Exact orWrap), padding values, and layer gravity (Start,Center orEnd).

ScrollbarsLayerContentType

TheScrollbarsLayerContentType can be one of the following:

  • None: The empty (not visible) layer content.
  • Custom: Provides custom layer content via the@Composable lambda.
  • Default: The default layer content.

TheDefault mode can set the content layer shape, style (Backgrond orBorder), color (Idle orIdleActive).

ScrollbarsVisibilityType

TheScrollbarsVisibilityType can be one of the following:

  • Static: The static scrollbars visibility.
  • Dynamic: The dynamic scrollbars visibility. Includes in/out animation, fading and other.

TheDynamic mode can be one of the following:

  • Fade: The dynamic visibility with only fade.
  • Slide: The dynamic visibility with the slide, and optional fade.
  • Scale: The dynamic visibility with the scale, and optional fade.

TheDynamic mode can the following UX utility params:

  • isVisibleWhenScrollNotPossible: Indicates whether scrollbars are visible when the scroll is not possible (short content).
  • isVisibleOnTouchDown: Indicates whether scrollbars are visible when any press/touch down event occurred.
  • isStaticWhenScrollPossible: Indicates whether scrollbars are statically visible only when the scroll is possible.

ScrollbarsScrollType

TheScrollbarsScrollType can be one of the following:

  • Scroll: The scrollbars for aScrollState content.
  • Lazy.List: The scrollbars for aLazyListState content.
  • Lazy.Grid: The scrollbars for aLazyGridState content.
  • Lazy.StaggeredGrid: The scrollbars for aLazyStaggeredGridState content.

TheLazy.List andLazy.Grid supports the scrollbars forStatic orDynamic items heights.

TheLazy.StaggeredGrid only supports the scrollbars forDynamic items heights.

Each mode can set the knob size type:

  • Auto: The scrollbars knob with an automatic size.
  • Exact: The scrollbars knob with an exact size.
  • Fraction: The scrollbars knob with a fraction size.
  • Worm: The scrollbars knob with a size, which represents current visible items as a section or with sub-interpolation. Only available forDynamic item heights.

License

MIT License. See theLICENSE file for more details.

Credits

Special thanks to theGoDaddy for the amazingcolor picker library.

Author:

Basil Miller
gigamole53@gmail.com


[8]ページ先頭

©2009-2025 Movatter.jp