AndroidFlowLayout icon indicating copy to clipboard operation
AndroidFlowLayout copied to clipboard

A mistake in onMeasure function.

Open xyc112233 opened this issue 9 years ago • 6 comments

There is a mistake in your code:

        if (childLeft + childWidth + paddingRight > myWidth) {
            childLeft = paddingLeft;
            childTop += mVerticalSpacing + lineHeight;
            lineHeight = childHeight;

Please change it to:

        if (childLeft + childWidth + paddingRight > myWidth) {
            childLeft = paddingLeft + childWidth;
            childTop += mVerticalSpacing + lineHeight;
            lineHeight = childHeight;

xyc112233 avatar Aug 20 '15 07:08 xyc112233

Sorry, have you ever run the code to see what happens if you changed the code like that ?

liangfeidotme avatar Aug 20 '15 09:08 liangfeidotme

I agree with xyc112233 There is a mistake in the following code:

if (childLeft + childWidth + paddingRight > myWidth) {
                childLeft = paddingLeft;
                childTop += mVerticalSpacing + lineHeight;
                lineHeight = childHeight;
} else {
                childLeft += childWidth + mHorizontalSpacing;
}

change to : (This works well for me)

if (childLeft + childWidth + paddingRight > myWidth) {
            childLeft = paddingLeft;
            childTop += mVerticalSpacing + lineHeight;
            lineHeight = childHeight;
}
childLeft += childWidth + mHorizontalSpacing;

sleepfin avatar Sep 14 '15 04:09 sleepfin

When I use this library with scroll view it is not functioning correctly.Can I use this for flow layout inside Scroll view?

Bhuvanaarkala07 avatar Oct 03 '15 08:10 Bhuvanaarkala07

@sleepfin I agree with you

coolguozhen avatar Nov 12 '15 10:11 coolguozhen

@xyc112233 √

xiewinson avatar Dec 17 '15 10:12 xiewinson

博主,老外说的代码问题,确实是,外层如果有ScrollView就会出现显示不全

JM0425 avatar Aug 12 '16 07:08 JM0425