@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int h = getMeasuredHeight(); int w = getMeasuredWidth(); if (h > 0 && w > 0) { if (w < h) { if (View.MeasureSpec.getMode(ViewCompat.getMeasuredHeightAndState(this)) != MeasureSpec.EXACTLY) { h = w; } } else if (h < w) { if (View.MeasureSpec.getMode(ViewCompat.getMeasuredWidthAndState(this)) != MeasureSpec.EXACTLY) { w = h; } } } setMeasuredDimension(w, h); } }
if (mContentView == null) return; int parentViewWidth = ViewCompat.getMeasuredWidthAndState(this); int contentViewWidth = ViewCompat.getMeasuredWidthAndState(mContentView); int contentViewHeight = ViewCompat.getMeasuredHeightAndState(mContentView); LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); int menuViewWidth = ViewCompat.getMeasuredWidthAndState(mEndSwiper.getMenuView()); int menuViewHeight = ViewCompat.getMeasuredHeightAndState(mEndSwiper.getMenuView()); lp = (LayoutParams) mEndSwiper.getMenuView().getLayoutParams(); int menuViewWidth = ViewCompat.getMeasuredWidthAndState(mBeginSwiper.getMenuView()); int menuViewHeight = ViewCompat.getMeasuredHeightAndState(mBeginSwiper.getMenuView()); lp = (LayoutParams) mBeginSwiper.getMenuView().getLayoutParams();
int parentViewWidth = ViewCompat.getMeasuredWidthAndState(this); LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); int tGap = getPaddingTop() + lp.topMargin; int menuViewWidth = ViewCompat.getMeasuredWidthAndState(mEndSwiper.getMenuView()); int menuViewHeight = ViewCompat.getMeasuredHeightAndState(mEndSwiper.getMenuView()); if (mBeginSwiper.getMenuView() == mEndSwiper.getMenuView()) {