Skip to content

INAPPROPRIATE code inside onMeasure function #19

@droidevs

Description

@droidevs
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    //默认全屏
    int widthMode = MeasureSpec.getMode(widthMeasureSpec);
    int widthSize = MeasureSpec.getSize(widthMeasureSpec);
    int widthResult = 0;
    if (widthMode == MeasureSpec.EXACTLY) {
      widthResult = widthSize;
    } else {
      widthResult = **screenWidth**;
    }
    int heightMode = MeasureSpec.getMode(heightMeasureSpec);
    int heightSize = MeasureSpec.getSize(heightMeasureSpec);
    int heightResult = 0;
    if (heightMode == MeasureSpec.EXACTLY) {
      heightResult = heightSize;
    } else {
      heightResult = **screenHeight**;
    }
    //初始化侧滑菜单
    initSlideView(widthResult, heightResult);

    measureSlideChild(mContentView, widthMeasureSpec, heightMeasureSpec);
    measureSlideChild(mLeftView, widthMeasureSpec, heightMeasureSpec);
    measureSlideChild(mRightView, widthMeasureSpec, heightMeasureSpec);

    setMeasuredDimension(mContentWidth, mContentHeight);
  }

using screen width and screen height is not appropriate
use parent width or height minus both paddings [case of : MATH PARENT]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions