daimajia / AndroidSwipeLayout

The Most Powerful Swipe Layout!
MIT License
12.38k stars 2.67k forks source link

导致mode为Single,滑动物宽度不为全屏时,滑动物拖出时存在随机偏移的解决办法 #349

Open purplelavender opened 8 years ago

purplelavender commented 8 years ago

将SwipeItemMangerImpl类里面的 class OnLayoutListener implements SwipeLayout.OnLayout {

    private int position;

    OnLayoutListener(int position) {
        this.position = position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    @Override
    public void onLayout(SwipeLayout v) {
        if (isOpen(position)) {
            v.open(false, false);
        } else {
            v.close(false, false);
        }
    }
}

open和close方法的第一个参数改为true即可。

因为传两个false过去,在SwipeLayout里面又对滑出的滑动物进行了一次宽高计算(详见源码),传true跳过即可,亲测,不再出现滑动偏移的问题,也不会消失。

zhenghengZN commented 7 years ago

快速滑动时仍然会出现

yummyChina commented 6 years ago

感觉快速滑动是recyclerview的锅,发现现在的recyclerview 在快速滑动时 会发生很多预料不到的问题