LayoutManager-FlowLayout icon indicating copy to clipboard operation
LayoutManager-FlowLayout copied to clipboard

刷新数据后 每个标签之间的间距变大

Open ZCGObject opened this issue 6 years ago • 10 comments

调用notifydatasetchanged后 标签的间距变得超大 , 并且没找到你在哪里有设置标签的间距

ZCGObject avatar Jan 24 '19 09:01 ZCGObject

这里提交过一次。用最新的代码吧。还没更新版本

发自我的 iPhone

在 2019年1月24日,17:37,ZCGObject [email protected] 写道:

调用notifydatasetchanged后 标签的间距变得超大 , 并且没找到你在哪里有设置标签的间距

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

xiangcman avatar Jan 25 '19 01:01 xiangcman

我运行的应该就是你最新的代码。我发现是因为这句代码 productHolder.des.addItemDecoration(new SpaceItemDecoration(dp2px(10))); 刷新时重复添加造成的。 你提交的最新的有处理这里吗? 我自己加了一个条件判断暂时解决了,你可以看一下会有什么问题吗? public ArrayList<SpaceItemDecoration> spaceItemDecorations = new ArrayList<>(); if(position >= spaceItemDecorations.size()){ SpaceItemDecoration spaceItemDecoration = new SpaceItemDecoration(dp2px(10), dp2px(5)); spaceItemDecorations.add(spaceItemDecoration); productHolder.des.addItemDecoration(spaceItemDecoration); } 麻烦你了,谢谢!!!

ZCGObject avatar Jan 25 '19 01:01 ZCGObject

这块之前有人处理过,这个不能重复调用,你通过判断是不是空来需不需要调用该方法。

在 2019年1月25日,09:45,ZCGObject [email protected] 写道:

我运行的应该就是你最新的代码。我发现是因为这句代码 productHolder.des.addItemDecoration(new SpaceItemDecoration(dp2px(10))); 刷新时重复添加造成的。 你提交的最新的有处理这里吗? 我自己加了一个条件判断暂时解决了,你可以看一下会有什么问题吗? public ArrayList spaceItemDecorations = new ArrayList<>(); if(position >= spaceItemDecorations.size()){ SpaceItemDecoration spaceItemDecoration = new SpaceItemDecoration(dp2px(10), dp2px(5)); spaceItemDecorations.add(spaceItemDecoration); productHolder.des.addItemDecoration(spaceItemDecoration); } 麻烦你了,谢谢!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xiangcman/LayoutManager-FlowLayout/issues/24#issuecomment-457425567, or mute the thread https://github.com/notifications/unsubscribe-auth/AHbxxTxv-3KtnjV6q5_lkl9uJ5ng6WkVks5vGmHIgaJpZM4aQeXE.

xiangcman avatar Jan 25 '19 01:01 xiangcman

能告知一下怎么判断不为空的吗?

ZCGObject avatar Jan 25 '19 01:01 ZCGObject

你加我qq 1002326270

xiangcman avatar Jan 25 '19 02:01 xiangcman

来了老弟

mosentest avatar Feb 28 '19 01:02 mosentest

这个问题看demo 已经处理过了

发自我的 iPhone

在 2019年2月28日,09:26,mo [email protected] 写道:

来了老弟

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

xiangcman avatar Feb 28 '19 01:02 xiangcman

demo没修复吧哥

mosentest avatar Feb 28 '19 01:02 mosentest

Object tag = productHolder.des.getTag();
        if (tag == null || (tag instanceof Boolean && (Boolean) tag == false)) {
            productHolder.des.addItemDecoration(new SpaceItemDecoration(dp2px(10)));
            productHolder.des.setTag(true);
        } else {
            //productHolder.des.setTag(false);
        }

mosentest avatar Feb 28 '19 01:02 mosentest

看下vp_flow分支的代码

在 2019年2月28日,09:40,mo [email protected] 写道:

Object tag = productHolder.des.getTag(); if (tag == null || (tag instanceof Boolean && (Boolean) tag == false)) { productHolder.des.addItemDecoration(new SpaceItemDecoration(dp2px(10))); productHolder.des.setTag(true); } else { //productHolder.des.setTag(false); } — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xiangcman/LayoutManager-FlowLayout/issues/24#issuecomment-468101743, or mute the thread https://github.com/notifications/unsubscribe-auth/AHbxxcLBW6LAD7udmMSSc-j83HEWQjXXks5vRzOLgaJpZM4aQeXE.

xiangcman avatar Feb 28 '19 01:02 xiangcman