Code example for View

Methods: getMeasuredWidth

0
    @Override 
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int width = View.resolveSize(0, widthMeasureSpec);
        int height = View.resolveSize(0, heightMeasureSpec);
         
        final View anchor = mAnchor;
        measureChild(anchor, widthMeasureSpec, heightMeasureSpec);
         
        final View button = mButton;
        measureChild(button, MeasureSpec.makeMeasureSpec(anchor.getMeasuredWidth(),
                MeasureSpec.EXACTLY),
                heightMeasureSpec);
        button.setOnClickListener(mToggler);
         
        final View content = mContent;
        int contentWidth = width - mClosedLimit;
        content.measure(MeasureSpec.makeMeasureSpec(contentWidth, MeasureSpec.EXACTLY),
                MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
         
        setMeasuredDimension(width, height);
Experience pair programming with AI  Get Codota for Java