android - Jetpack Compose 是否有创建自定义过度滚动效果的工具?

标签 android android-jetpack-compose

有没有办法在jetpack compose中创建OverscrollEffect?

类似这样的事情:

enter image description here

最佳答案

过度滚动效果可以通过LocalOverscrollConfiguration来控制,目前有以下参数:

glowColor - color for the glow effect, if the platform effect is a glow effect, otherwise ignored.
forceShowAlways - force show overscroll even if content doesn't scroll (is smaller than a scrollable container itself)
drawPadding - the amount of padding to apply from scrollable container bounds to effect before drawing it

CompositionLocalProvider(
    LocalOverscrollConfiguration provides OverScrollConfiguration(
        glowColor = Color.Gray,
        forceShowAlways = false,
        drawPadding = PaddingValues()
    )
) {
    // effected views
}

如果您认为应该有更多参数,可以通过 creating a feature request 告知维护者.


附:在 1.2.0-rc01 LocalOverScrollConfiguration 已重命名为 LocalOverscrollConfiguration

关于android - Jetpack Compose 是否有创建自定义过度滚动效果的工具?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70631544/

相关文章:

android - 使用android intent在特定时间打开youtube视频

android - 尝试在空对象引用上调用虚拟方法 'android.graphics.Rect android.graphics.drawable.Drawable.getBounds()'

android - Jetpack 组合单个数字文本字段

android - 带有分支的 Android 调查应用程序

java - 如何更改Android中屏幕底部的软导航背景和图标颜色?

android - 您能协助移除android中找不到文件的异常错误吗?

android - 有没有办法强制显示 Jetpack Compose 文本?

android - Jetpack Compose View 中未显示行项目之一

android 数据存储首选项 : Property delegate must have a 'getValue(Context, KProperty<*>)' method

android - lambda 函数中的类型不匹配 - Kotlin