相关疑难解决方法(0)

如何在jetpack compose Lazy Column上实现弹跳效果

我想在 LazyColumn 上实现“类似 iOS”的反弹效果,但不知道如何实现它。

预期结果是:类似于 Android 上的 iOS 滚动效果(使用 RecyclerView),列表顶部和底部有弹跳。

我浏览了 Chris Bane 的 snapper: https: //github.com/chrisbanes/snapper但它似乎不支持它。

我的猜测是我需要创建一些 LazyListScope 扩展,但很难弄清楚。

先感谢您!

android android-jetpack-compose

10
推荐指数
1
解决办法
3167
查看次数

iOS喜欢Android上的滚动效果

我想在我的应用程序中实现类似iOS的反弹过度滚动效果.

我遇到了这个链接,建议创建一个自定义ScrollView.但问题是,当我快速上下滚动它工作正常但是一旦我拉动屏幕的底部或顶部它就会卡住而且效果不再起作用.

作为我想要实现的那种动画的一个例子,你可以看看这个:

这是我目前的代码:

public class ObservableScrollView extends ScrollView
{
    private static final int MAX_Y_OVERSCROLL_DISTANCE = 150;

    private Context mContext;
    private int mMaxYOverscrollDistance;

    public ObservableScrollView(Context context)
    {
        super(context);
        mContext = context;
        initBounceScrollView();
    }

    public ObservableScrollView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        mContext = context;
        initBounceScrollView();
    }

    public ObservableScrollView(Context context, AttributeSet attrs, int defStyle)
    {
        super(context, attrs, defStyle);
        mContext = context;
        initBounceScrollView();
    }

    private void initBounceScrollView()
    {
        //get the density of the screen and do some maths …
Run Code Online (Sandbox Code Playgroud)

java animation android android-animation android-scrollview

8
推荐指数
2
解决办法
9682
查看次数