android-flowlayout icon indicating copy to clipboard operation
android-flowlayout copied to clipboard

Get actual height

Open konopkoman opened this issue 6 years ago • 0 comments

Initially my FlowLayout is hidden, then I want to expand it using animation. The layout contains two lines of tags (buttons). The problem is I can't get actual height of FlowLayout with multiple lines of tags: it returns height (not sure) of single-line container. Verbose question.

Animation expand code:

        v.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        final int targetHeight = v.getMeasuredHeight();

        v.getLayoutParams().height = 1;
        v.setVisibility(View.VISIBLE);
        Animation a = new Animation(){
            @Override
            protected void applyTransformation(float interpolatedTime, Transformation t) {
                v.getLayoutParams().height = interpolatedTime == 1
                        ? ViewGroup.LayoutParams.WRAP_CONTENT
                        : (int)(targetHeight * interpolatedTime);
                v.requestLayout();
            }

            @Override
            public boolean willChangeBounds() {
                return true;
            }
        };

konopkoman avatar Aug 28 '18 12:08 konopkoman