AAkira / ExpandableLayout

[Deprecated] An android library that brings the expandable layout with various animation. You can include optional contents and use everywhere.
Apache License 2.0
1.65k stars 325 forks source link

TextVirew incorrectly considers the size of the strings breaks #81

Open Fast-IQ opened 8 years ago

Fast-IQ commented 8 years ago

TextView does not correctly calculate its size being in ExpandableLinearLayout with a vertical orientation and . android:layout_height="wrap content"android:layout_marginLeft="32dp") it ignores the indentation. To solve this problem, I changed a bit the code onMeasure (...

                view = getChildAt(i);
                params = (LayoutParams) view.getLayoutParams();
                view.measure(MeasureSpec.makeMeasureSpec(view.getMeasuredWidth()- params.leftMargin -                                 params.rightMargin, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));

.... ). And replaced to account for the opening.

if (!defaultExpanded) {
            setLayoutSize(closePosition);

to

setLayoutSize(
                (isExpanded()
                ?layoutSize
                :closePosition)
            );

May still have to add a check for horizontal orientation. While nothing to check.