Java Code Examples for android.widget.RelativeLayout.measure()

The following are Jave code examples for showing how to use measure() of the android.widget.RelativeLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: EditorImageAndText   File: ViewHolderAnimator.java   Source Code and License Vote up 6 votes
public static Animator ofItemViewHeight(RecyclerView.ViewHolder holder, RelativeLayout rl_item) {
//        View parent = (View) holder.itemView.getParent();
//        if (parent == null)
//            throw new IllegalStateException("Cannot animate the layout of a view that has no parent");

        int start = rl_item.getMeasuredHeight();
        rl_item.measure(View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
        int end = rl_item.getMeasuredHeight();

        final Animator animator = LayoutAnimator.ofHeight(rl_item, start, end);
        animator.addListener(new ViewHolderAnimatorListener(holder));

        animator.addListener(new LayoutParamsAnimatorListener(rl_item, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

        return animator;
    }